cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Dhinesh28R
Post Prodigy
Post Prodigy

Office365Users.UserPhotoMetadata(Id).HasPhoto Error

Hi,

 

I stored a value in my collection. And from that collection get a Mail.. 

I want to show user photo through from collection's mail..

 

i got a  following issue 

metadata.png

Am giving id in Userphotometadata.

But it shows error.. While am using mail also its getting error.

 

How to solve this UserPhotoMetadata error?

 

Thanks,

Dhinesh

1 ACCEPTED SOLUTION

Accepted Solutions

Hi@Dhinesh28R,

Could you please tell me how you collect this collection, post your Collect formula which is the key.

ThisItem only works in a Gallery, do you put your collection into a Gallery?

To test, please try to add a Gallery and set the Items property as below:

YourCollectionName

Make your Gallery layout containing Image as follows:

2021-02-25-01.png

Set the Image property as below:

If(
    !IsBlank(ThisItem.Id),
    If(
        Office365Users.UserPhotoMetadata(ThisItem.Id).HasPhoto = true,
        Office365Users.UserPhotoV2(ThisItem.Id),
        SampleImage
    )
)

Please make sure that you refer to the Id directly as abpve.

Hope it helps.

Regards,

Qi

Best Regards,
Qi

View solution in original post

8 REPLIES 8
v-qiaqi-msft
Community Support
Community Support

Hi@Dhinesh28R,

Glad to see you and hope we could solve this again.

Do you want to display the user photo?

Could you please tell that how you create the collection?

Office365Users.UserPhotoMetadata() expects the userid(Principal Name/ Email ID) of the user for which we want to search data for.

Please make sure that you are passing correct data inside office365 function. 

From your formula, you could not just refer to the Id within the Office365Users.UserPhotoMetadata().

Add a Gallery and set the Image property as below:

If(
    !IsBlank(ThisItem.Senior.Email),
    If(
        Office365Users.UserPhotoMetadata(ThisItem.Senior.Email).HasPhoto = true,
        Office365Users.UserPhotoV2(ThisItem.Senior.Email),
        SampleImage
    )
)

Note: If you want to display the certain user photo, you should find the related record firstly from your collection and refer to the userid(Principal Name/ Email ID).

ppp.png

Regards,

Qi

Best Regards,
Qi

Hi @v-qiaqi-msft ,

Glad to see you again, Yes i want to display a user photo.

I created a collection with Name, id, phot and UserPrinicipalName.
Am passing into Office365Users.UserPhotoMetadata(Id/Mail).  its getting error only. 

And also am using this Office365Users.UserPhotoMetadata(Id/Mail).  within a collection.. not a gallery

Now also its getting error.

 

Thanks,

Dhinesh

 

Hi@Dhinesh28R,

I just provide a sample for reference.

I mentioned that you should not refer to the Id/Mail in the Office365Users.UserPhotoMetadata() directly. You should find the Id using a formula to determine which user you want to display the user photo.

Who's Id you want to find is the key to this issue.

If there are many users in your collection and you just want to display one of them, find this user from your collection.

Office365Users.UserPhoto(LookUp(Col1,DisplayName="Qi Qiao").Id)

Regards,

Qi

Best Regards,
Qi

HI @v-qiaqi-msft ,

I just gave only one user (ThisItem.UserPrincipalName) within metada. It shows error "No resource Found".

 

Thanks,

Dhinesh.

Hi@Dhinesh28R,

Could you please tell me how you collect this collection, post your Collect formula which is the key.

ThisItem only works in a Gallery, do you put your collection into a Gallery?

To test, please try to add a Gallery and set the Items property as below:

YourCollectionName

Make your Gallery layout containing Image as follows:

2021-02-25-01.png

Set the Image property as below:

If(
    !IsBlank(ThisItem.Id),
    If(
        Office365Users.UserPhotoMetadata(ThisItem.Id).HasPhoto = true,
        Office365Users.UserPhotoV2(ThisItem.Id),
        SampleImage
    )
)

Please make sure that you refer to the Id directly as abpve.

Hope it helps.

Regards,

Qi

Best Regards,
Qi

HI @v-qiaqi-msft ,

This works fine man, But shows error on Metadata "Resource not Found" something "User not found".

 

NameMailIdPhotoMail
DhineshDhinesh@sample.com13214 Dhinesh@sample.com
SureshSuresh@sample.com45321 Suresh@sample.com

 

This s my collection looks like.

 

AM using this collection into a gallery ,

 

Am using this formula into a image property of gallery,

If(
!IsBlank(ThisItem.Id),
If(
Office365Users.UserPhotoMetadata(ThisItem.Id).HasPhoto = true,
Office365Users.UserPhotoV2(ThisItem.Id),
Image
)
)

But its shows error in metadata. But it displays image in a gallery. Appears error.

 

Thanks,

Dhinesh

 

 

Hi@Hi@Dhinesh28R,

I have reproduce the issue you mentioned and the situation is confirmed on my side.

The reason why you met this is probably that there are some guest users who are not in your tenant.

The Office365Users.UserPhotoV2() could only search for the users who are the owner of the group rather than the guests.

Please make sure that all the users are internal users.

Hope it could help.

Regards,

Qi

Best Regards,
Qi

Hi @v-qiaqi-msft ,

Okay man, i will check .

 

Thanks,

Dhinesh

Helpful resources

Announcements
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.

Carousel_PP_768x460_Wave2 (1).png

2022 Release Wave 2 Plan

Power Platform release plan for the 2022 release wave 2 describes all new features releasing from October 2022 through March 2023.

365 EduCon 768x460.png

Microsoft 365 EduCon

Join us for two optional days of workshops and a 3-day conference, you can choose from over 130 sessions in multiple tracks and 25 workshops.

Users online (5,705)