6

Trying to use the "call http web service" action from a SharePoint Designer 2013 workflow to get the user's manager. The url for the web service is:

https://server/_api/SP.UserProfiles.PeopleManager/GetUserProfilePropertyFor(accountName=@v,propertyName='Manager')?@v='domain\username'.

This url returns a value when tested from the browser. Outputting the response code to the log consistently results in "unauthorized". I have tried the "call http web service" action both in and out of an app step.

This is SharePoint 2013, on-premise.

How do I successfully call the user profile service, or is there an easier way to get the users manager?

2 Answers 2

6

The workflow app, by default, doesn't have access to the UserProfile for REST calls

Try following these steps to grant the workflow more rights:

  1. Go to your site collection settings and click on App permissions (/_layouts/15/appprincipals.aspx?Scope=Web)
  2. Make note of the App ID for your Workflow - it will be the GUID between i:0i.t|ms.sp.ext| and the @ sign
  3. Go to your site collection's appinv.aspx page (/_layouts/15/appinv.aspx)
  4. At the appinv.aspx page, fill in the Application ID and click the search button next to the ID box
  5. Fill out the permission request box with the XML detailing the permissions you would like to grant (examples in the reference page)
    • In your case I would try:

        <AppPermissionRequests>
          <AppPermissionRequest Scope="http://sharepoint/social/tenant" Right="Read" />
        </AppPermissionRequests></li>
      

Reference: http://msdn.microsoft.com/en-us/library/office/fp142383(v=office.15).aspx

You might also try adding a AppOnlyStep and enabling the web feature "Workflow Can Use App Permissions"

7
  • Thanks, though when I go to trust it I now get "Sorry, only tenant administrators can add or give access to this app". (I'm a farm admin and a site collection admin)
    – Mike2500
    Commented Jan 15, 2015 at 18:51
  • Try adding yourself explicitly (without using a group) as an administrator for the SharePoint server (windows).
    – Choggo
    Commented Jan 15, 2015 at 18:53
  • I'll try it, but wow... That would make these types of workflows completely unusable for most people.
    – Mike2500
    Commented Jan 15, 2015 at 18:56
  • I have had to give more permissions to my workflow, but I haven't queried the Profile service, so I am guessing a bit. It's just more steps then would fit in the comment box. As for the Tenant admin, I think it's a bug that you need to be local admin to be able to add permissions.
    – Choggo
    Commented Jan 15, 2015 at 18:58
  • Awesome! Glad to hear it =]
    – Choggo
    Commented Jan 15, 2015 at 22:13
0

Make sure you use an App Step for calling the HTTP Request.

Make sure you give the required rights to the Workflow App.

Make sure you pass no requestHeader to the HTTP Request
(or you might get an Unauthorized/Forbidden response).

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.