cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
jtepp
Level: Power Up

O365 User information lookup error

Trying to create a validation tool for multiple datasets, against our O365/AzureAD Values.

 

I found this bit of code

First(Office365Users.UserProfile((ThisItem.UserPrincipalName)).BusinessPhones).Value

Which can be used to dynamically show a phone number for the users that show up via text input search to a gallery.

 

I continue to recieve the following error though:

Office365.Users.UserProfile Failed: {
"Status": 404,
"Message": No user Found with the Specified id.r/nclientrequestid: (An ID number of some sort)
"Source": "office365users-pa-usgv.azurewebsites.us"
}

The code works but it prevents the app from being used outside of Edit mode (Which it works fine in, and shows the correct phone number for people), if i attempt to run the app the gallery wont load.

5 REPLIES 5
Super User
Super User

Re: O365 User information lookup error

@jtepp 

Try changing your formula to the following:

First(Office365Users.UserProfile(ThisItem.UserPrincipalName).BusinessPhones).Value

This may or may not be the issue, but the double parenthesis you had before around the UserPrincipalName...I've seen that be evaluate to "true" rather than the actual value you want.  It's possible that is what is happening.

Let's start there...

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
jtepp
Level: Power Up

Re: O365 User information lookup error

Sorry! That was a typo when i wrote it out here, it does not have that in the code I am using.

Error remains the same.

 

Here's another version using the v2 user profile, which gives a different error

First(Office365Users.UserProfileV2(ThisItem.UserPrincipalName).businessPhones).Value

O365.Users.UserProfileV2 failed: {"error": {"code": "Request_BadRequest", "message": "Bad Request - Error in query syntax." "inner error"

Super User
Super User

Re: O365 User information lookup error

@jtepp 

I'm not seeing an issue with the formula then.  It works fine here (edit and play mode).

The only difference is that I am testing against a hard coded email address instead of a list.

So,

1) perhaps roll back a stage and look at your Items property for the Gallery that this is coming from.

2) change the .UserPrincipalName to .mail to see if there are any changes (usually that is backward from what is normal - but worth a try)

3) Try to change your formula to Concat(Office365Users.UserProfileV2(ThisItem.UserPrincipalName), businessPhones & ",")  this will combine any values in the businessPhones table into one string.

 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
Highlighted
ebaron
Level: Powered On

Re: O365 User information lookup error

Hi @jtepp 

 

same issue for me

I've tried with this formula, seems better 🙂

First(Office365Users.SearchUser({searchTerm:Authir.DisplayName})).TelephoneNumber

 

Or maybe you can manager this with a Flow..

K-A-R-L
Level 10

Re: O365 User information lookup error

Hi @jtepp ,

It seems like the error is because some of the users are not part of your tenant (most likely guest user or external contacts on office365).

To test this:

Try adding your email address: No Error

 

First(Office365Users.UserProfile(("Your email address")).BusinessPhones).Value 

 

Try adding an email address of a Guest user from admin portal > users > Guest Users: Error

First(Office365Users.UserProfile(("Guest Users Email Address")).BusinessPhones).Value 

 

----------------------------------------------------------------------------
Thanks,
K-A-R-L


If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
If you thought this post was helpful, please give it a Thumbs Up.

Helpful resources

Announcements
thirdimage

Power Apps Super User Class of 2020

Check it out!

thirdimage

New Badges

Check it out!

thirdimage

Power Apps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

SecondImage

Difinity Conference

The largest Power BI, Power Platform, and Data conference in New Zealand

Top Solution Authors
Top Kudoed Authors
Users online (4,692)