1

I'm testing REST results in the browser with mixed results.

The following URL returns the expected result:

https://xxxxx.sharepoint.com/sites/site/_api/SP.UserProfiles.PeopleManager/GetUserProfilePropertyFor(accountName=@v,propertyName='Manager')?@v=%27i%3A0%23.f%7Cmembership%7Cxxx@xxxxx.com%27

however the following URL returns an error:

https://xxxxx-AppGUID.sharepoint.com/sites/site/_api/SP.AppContextSite(@target)/SP.UserProfiles.PeopleManager/GetUserProfilePropertyFor(accountName=@v,propertyName='Manager')?@v=%27i%3A0%23.f%7Cmembership%7Cxxx%40xxxxx.com%27&@target=%27https%3A%2F%2Fxxxxx.sharepoint.com%2Fsites%2Fsite%27

I get the error code -1, Microsoft.SharePoint.Client.ResourceNotFoundException and error message Cannot find resource for the request sp.userprofiles.peoplemanager. Google doesn't offer up much for the errors. Fiddler responds with a 404 result. I've tried leaving the URL unencoded, tried with lower case sp.userprofiles.peoplemanager and getuserprofilepropertyfor with no luck whatsover. I have also tried other methods within sp.userprofiles.peoplemanager. What am I doing wrong?

  • 2
    You don't need to use the cross-domain library for user profile properties. User profile properties do not change across different sites, since the user profile service runs on its own web app. Just use the first url, the one that works. – wjervis Mar 27 '15 at 1:50
  • Thanks. I tried that originally and got a 403 Forbidden response. Since I can access it through the browser, I honestly assumed I needed to use the cross domain library. Calling ~/sites/site/_api/Web/GetUserById(id) without the cross domain library works fine. What kind of error should I see if I'm not using the cross domain library when I need to be? – James Grizzle Mar 27 '15 at 2:01
  • 2
    Did you give the app read permissions to the user profiles? The 403 would indicate that. – wjervis Mar 27 '15 at 2:01
  • Oh my. I've been a giant idiot. Thank you so much. I have to wait for tenant admin approval to test but in all likelihood, you have found my problem. – James Grizzle Mar 27 '15 at 2:04
  • Glad I can help. – wjervis Mar 27 '15 at 2:05
0

I just needed to grant the app read permissions to the user profiles.

  • Can you tell me what permission you set? I have granted my app "User Profiles (social)" access, but I am still getting the 404 "Cannot find resource for the request sp.userprofiles.peoplemanager" error. – Ray Hogan Jul 25 '16 at 17:03
0

How do you grant an app permissions to the user profiles? I am only a site admin, is that something you have to do at the server?
What would be the app? Is that the site collection url?

  • HI mate, may you please raise this as another question. – James Randal Jul 2 at 1:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.