0

I'm trying to get a user's property using a REST call in a Visual Studio workflow.

The rest call:

/_api/SP.UserProfiles.PeopleManager/GetUserProfilePropertyFor(accountname='i:0%23.f%7Cmembership%[email protected]',propertyName='Manager')

This works if I simply append it to an URL and returns

The return:

<d:GetUserProfilePropertyFor xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns:georss="http://www.georss.org/georss" xmlns:gml="http://www.opengis.net/gml">i:0#.f|membership|[email protected]</d:GetUserProfilePropertyFor>

Now I tried this simple workflow...

Workflow: Workflow

...but it won't return the expected value, it's just returning a blank value. My best guess is that my path is wrong, and I should be calling something like d/GetUserPropertyFor/0 or some index?

Update

I got it to work. I messed with the app permissions as well as the API string I was using and all is working perfectly!

2 Answers 2

0

Try to specify Authorization="" for your RequestHeaders.

You could log the response code to debug the error.

enter image description here

My result:

enter image description here

enter image description here

1
  • I logged the fix you provided with the headers but I'm getting a {"error":{"code":"-2147024891, System.UnauthorizedAccessException","message":{"lang":"en-US","value":"Access denied. You do not have permission to perform this action or access this resource."}}}.
    – Gabe
    Commented Jan 5, 2018 at 13:07
0

I am able to resolve this issue by granting full acess to Workflow service account at Webapplication level (Webapplicaiton --> User Policy).

As well as below request headers.

Accept: "application/json;odata=verbose"

Content-Type: "application/json;odata=verbose"

Authorization: ""

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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