UnauthorizedAccessException error when using REST Call in Workflow

Copper Contributor

I am trying to get a user's line manager in a workflow in a SharePoint online site collection.

I have followed the exact steps here and and also running with App Step -elevated permissions- as you can see in screenshot. I have already gave trust to Workflow on appinv.aspx following the steps here.

 

Capture.PNG

Rest call URL is something like this:https://mycompanyname.sharepoint.com/sites/forms/_api/SP.UserProfiles.PeopleManager/GetUserProfilePr...'Manager')?@v=%27i:0%23.f%7Cmembership%7CMYACCOUNT%27

With this URL I CAN access the response from browser, and get the line manager.

However in the workflow, no matter what I did it's erroring.

 

  {"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."}}} 

I logged the 'Dictionary'(Headers) and it looks like it's adding an extra / in there:

**{"Accept":"application\/json;odata=verbose","Content-Type":"application\/json;odata=verbose"}**

Result

log.PNG

this dictionary is looking like this in Workflow.

 

dictionary.PNG

I really don't understand why the Rest call is working in browser, and not working inside the workflow. As I said I have already given FullControl to Workflow app in appinv.aspx.

I am also unable to understand why it adds the extra "\" into the Request Header (Headers/ dictionary)

Please help! If GetUserProfilePropertyFor cannot be called like this, let me know so this torture ends.

1 Reply

Hello Ova,

we are solving all the same issue. Did you solved it?

Thank you.

Rob