Hi guys,
I've done all I could and need some expert advice here. I'm trying to get metadata as well as profile picture of guest users. I need to retrieve the profile picture in an image insert and metadata in a Display Form and Edit Form based on the selected person in the gallery. The gallery's data source comes from a SharePoint list. Everything works fine, except when a guest user is selected.
These guest users are hosted in our Azure AD. I've tried
- the Office365 connectors but they require the UPN or Object ID. For the guest user I am using the gallery.selected.email 1 (see below) field (text field from my SharePoint data source) but with the guest users the UPN differs from their email.
Office365Users.UserProfileV2(BrowseGallery_EMPLOYEE.Selected.'EMAIL 1').id
- the Azure AD connectors as well but the same required fields (UPN and Object ID) are the same.
AzureAD.GetUser(Unique identifier of a user Ex."user@tenant.onmicrosoft.com or 5f6ce5c7-b521-4842-....).id​​
So to retrieve the UPN I have constructed the following:
If(
IsBlankOrError(Office365Users.UserProfileV2(BrowseGallery_EMPLOYEE.Selected.'EMAIL 1').id),
Office365Users.UserPhotoV2(
Concatenate(
Left(
BrowseGallery_EMPLOYEE.Selected.'EMAIL 1',
Find(
"@",
BrowseGallery_EMPLOYEE.Selected.'EMAIL 1'
) - 1
),
"_",
Mid(
BrowseGallery_EMPLOYEE.Selected.'EMAIL 1',
Find(
"@",
BrowseGallery_EMPLOYEE.Selected.'EMAIL 1'
) + 1
),
"#EXT#@tenant.onmicrosoft.com"
)
),
Office365Users.UserPhotoV2(BrowseGallery_EMPLOYEE.Selected.'EMAIL 1')
)
the word "tenant" replaced in code "#EXT#"tenant".onmicrosoft.com" for security reasons
The above works perfectly when a tenant user is selected in the gallery. But when I select a guest user in the Gallery it gives me an error even though the the IsBlankOrError returns the Boolean (true/false)
As for the retrieval of the photo for guest users, the UPN does not work (I have tested this by inserting the UPN manually as text) only the Object ID is needed. So if I can use the email address and not the UPN from Azure AD (as I am passing the selected email address from the Gallery or Card) to retrieve the UPN and Object ID my problem would be solved.
Also, the reason for guest users:
We have a multi-brand company with 5 tenants. We built the app in the tenant with the majority employees and added users from other tenants as guest users in order to share the app with them and to get metadata and profile pictures. We also have guest users outside of our 5 tenant environment (service providers, franchisee owners, etc.)
Can anyone please advise on a solution here? Maybe a tenant connector would solve the problem????