cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Venkat_Veda
Frequent Visitor

Add/remove Photo to collection

Hi,

 

I have created a collection(UserPhoto) to collect user photo from Office365 Profile.

 

Now for People who do not have photos in Office365 Profile, I'm using add image option to upload photo.

 

I have set a variable (PhotoToUpload) to get the uploading image and using patch option to add it to the UserPhoto collection.

Patch(UserPhoto,LookUp(UserPhoto,UserId = MyUserId),{Photo:PhotoToUpload});

 

But the issue I have is, It changes the photo that I collected from Office365 Profile. 
I need help to find a way to patch the photo only if there are no photos in the collection.

1 ACCEPTED SOLUTION

Accepted Solutions
v-albai-msft
Community Support
Community Support

Hi @Venkat_Veda ,

Do you want to add a photo if the person does not have a photo.

I assume that:

1. Your Patch formula is correct,

2. “MyUserId” in your formula is the ID got from Office365, like below format(otherwise you need to get the userID from Office365 first):

v-albai-msft_0-1615536167594.png

If yes, based on your formula, you can add below condition to judge if this user already has a photo. This time Patch function will only work when the people doesn’t has a photo:

Patch(UserPhoto,If(Office365Users.UserPhotoMetadata(MyUserId).HasPhoto = false, LookUp(UserPhoto,UserId = MyUserId)),{Photo:PhotoToUpload})

Best Regards,

Allen

View solution in original post

1 REPLY 1
v-albai-msft
Community Support
Community Support

Hi @Venkat_Veda ,

Do you want to add a photo if the person does not have a photo.

I assume that:

1. Your Patch formula is correct,

2. “MyUserId” in your formula is the ID got from Office365, like below format(otherwise you need to get the userID from Office365 first):

v-albai-msft_0-1615536167594.png

If yes, based on your formula, you can add below condition to judge if this user already has a photo. This time Patch function will only work when the people doesn’t has a photo:

Patch(UserPhoto,If(Office365Users.UserPhotoMetadata(MyUserId).HasPhoto = false, LookUp(UserPhoto,UserId = MyUserId)),{Photo:PhotoToUpload})

Best Regards,

Allen

Helpful resources

Announcements
Power Platform Call June 2022 768x460.png

Power Platform Community Call

Join us for the next call on August 17, 2022 at 8am PDT.

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Users online (1,752)