cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
TonyFromTech
New Member

Auto Populate fields using Office365Users connector (UserProfileV2) throwing permission error

I'm trying to auto-populate 4 user fields (JobTitle, Department, Office, Location) in a SharePoint list form using Power Apps. 

 

I opened the SharePoint form from Power Apps to customize it.  I connected to the Office365Users connector.  The connector has my name/email on it.

 

I set each user field's card Default properties to:  

Office365Users.UserProfileV2(DataCardValue2.Selected.Email).officeLocation 

(DataCardValue2 is the People Picker Control)

 

When I select myself as the user, everything populates perfectly, in testing as well as after the form has been published to SharePoint. 

TonyFromTech_0-1659721311677.png

 

However, if I select any other users, I am getting the error and the auto-populating is failing:

TonyFromTech_1-1659721378413.png

I had heard that using UserProfileV2 didn't require heightened permissions since it was only accessing a read only copy of the data (and not writing anything).  

 

I tried deleting the Office365Users connector and reconnecting it and still no luck.  I'm new to Power Apps and hopefully this is an easy fix.  Thanks.

 

  

2 REPLIES 2
Drrickryp
Super User
Super User

@TonyFromTech 

  1. Add a combobox outside of the form and call it Combobox1 for example.
  2. Set Allow searching to "on" and the allow multiselect to "off" in the right side panel.
  3. Make the Items property of the combobox:  Office365Users.SearchUser({searchTerm:Self.SearchText,top:999})
  4. Set the DataSource and the Item property of the form to Combobox1.Selected
  5. The form will still say that it is not connected to a data source but ignore it.
  6. With the form selected, click on the edit fields dropdown (in the right column of the screen) and click on the ellipsis to add 4 custom cards. *See the screenshot below to find the ellipsis.
  7. Add a label to each card and change the Text property of the label to ThisItem.FieldName for each of your fields ie. ThisItem.Department, ThisItem.DisplayName, ThisItem.JobTitle etc. for each card respectively.

!1.jpg

@Drrickryp 

 

Thanks for the advice.  I did give it a shot and unfortunately it didn't solve my permission issue. 

I'm able to set up the auto-populating in the form.  Each card uses the Office365Users.UserProfileV2(DataCardValue2.Selected.Email).jobTitle (or whatever field I'm pulling in).  When I select my name, every card auto-populates perfectly.  When I select another user's name, I keep getting this error and nothing populates:   

Office354Users.UserProfileV2 failed: {"error": {"code": "Authorization_RequestDenied", "message": "Insufficient privileges to complete the operation.", "innerError": {"date": "2022-08-08T21:00:57", "request-id": "092ff1db-94ac-43dd-b30a-a8b41077b2cc", "client-request-id": "092ff1db-94ac-43dd-b30a-a8b41077b2cc"}}}

 

Like I said, when I choose my name (my email is on the connector), everything auto-populates perfectly.  Thanks.

Helpful resources

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

Difinity Conference 2022

Difinity Conference 2022

Register today for two amazing days of learning, featuring intensive learning sessions across multiple tracks, led by engaging and dynamic experts.

European SharePoint Conference

European SharePoint Conference

The European SharePoint Conference returns live and in-person November 28-December 1 with 4 Microsoft Keynotes, 9 Tutorials, and 120 Sessions.

Power Apps Ideas

Changes to Ideas Coming

We are excited to announce a new way to share your ideas for Power Apps!

Top Solution Authors
Top Kudoed Authors
Users online (3,922)