cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
mokhawaja
Kudo Collector
Kudo Collector

the service returned an error: Office365Users!UserProfile

Hi,

I am using the connection of Office365Users, to view the Display name of the CreatedByUser field using this function:

Office365Users.UserProfile(ThisItem.CreatedByUser).DisplayName

the display name displays correctly but when i save the app and reopen it always show this error:

 

"the service returned an error: Office365Users!UserProfile: the method 'UserProfile' has an invalid value for parameter 'userId'

 

so i am not sure what's wrong with it.

 

best regards,

Mohammad AlkhawajScreenshot (5).png

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @mokhawaja,

 

Please take a try to change the formula with the format below:

If(!IsBlank(ThisItem.CreatedByUser), Office365Users.UserProfile(ThisItem.CreatedByUser).DisplayName)

This would clear the error.

The error should be caused by Office365 call has been made before the Gallery has instantiated with all the values.

There should be updates being published on this soon.

Appreciate your patiencce.

Regards,

Michael

Community Support Team _ Michael Shao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

17 REPLIES 17
v-micsh-msft
Community Support
Community Support

Hi @mokhawaja,

 

Thanks for the feedback.

Issue confirmed from my side.

 

The documentation for Office365 users shared the following information:

"

Note: If you're developing an app based on an entity in the Common Data Service, you can specify a user based on ID instead of email address.

For example, you can create an app automatically, add a screen that contains a Text box control, and set the control's Text property to this formula:
Office365Users.UserProfile(BrowseGallery1.Selected.CreatedByUser).DisplayName

If you create a contact and select that contact in the browse screen of the app, the Text box control will show your display name.

"

I think this issue should be related with the function only.

I will forward this from my side, will update here if I have any information received.

Regards,

Michael

Community Support Team _ Michael Shao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi @mokhawaja,

 

Please take a try to change the formula with the format below:

If(!IsBlank(ThisItem.CreatedByUser), Office365Users.UserProfile(ThisItem.CreatedByUser).DisplayName)

This would clear the error.

The error should be caused by Office365 call has been made before the Gallery has instantiated with all the values.

There should be updates being published on this soon.

Appreciate your patiencce.

Regards,

Michael

Community Support Team _ Michael Shao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thank you @v-micsh-msft... it works perfectly.

i just wonder why the exclamation mark? in the function:

 

If(!IsBlank...

 

regards,

Mohammad

 

Hi @mokhawaja,

 

It is the Logical negation, equivalent to the Not function.

See:

Operators and data types in PowerApps

 

Regards,

Michael

 

Community Support Team _ Michael Shao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thanks for the clarification @v-micsh-msft

 

Best regards,

Mohammad

LEARN_IT
Helper III
Helper III

Hello,

How about displaying other User information. I would like to display Photo, department, position. I'm getting that error.

Formula im using:

 

If(Office365Users.UserPhotoMetadata(ThisItem.Employee_x0020_Name.Email).HasPhoto=false,SampleImage,Office365Users.UserPhoto(ThisItem.Employee_x0020_Name.Email))

 

Error: powerapps office365users.userphoto failed: the method 'userphto' has an invalid value for parameter userid'

How do I handle exception where no location exists in user profile? I am using the below formula. It works for those have location. But for others, it throws error. How do I handle this exception and display something like "NO Location"

 

If(!IsBlank( DataCardValue5_1.Selected.Email),Office365Users.UserProfile(DataCardValue5_1.Selected.Email).OfficeLocation)

 

Tried with IsError() formula, still I am unable to handle the Office365Users.UserProfile error.

 

Any help greatly appreciated,

 

Thanks!

Ravi

 

 

 

I think this is a known bug. Please correct me if I am wrong.

 

For example, both following functions looks for userId not Text string as parameter.

 

Office365Users.Manager(userId)
Office365Users.UserPhoto(userId)

userId: User principal Name or email Id

 

When you provide text string as parameter then error pop-up.

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

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