none
Getting Manager Name from SP.UserProfiles.PeopleManager REST API using Sharepoint Designer Workflow 2013 RRS feed

  • Question

  • I want to get the Manager Name using Sharepoint UserProfile REST API in Sharepoint designer Workflow 2013 by using "Call Http Webservice" action with url http://<site_URL>/_api/SP.UserProfiles.PeopleManager/GetUserProfilePropertyFor(accountName=@v,propertyName='Manager')?@v='domain\username' and i am able to get the result in JSON format

    {"d":{"GetUserProfilePropertyFor":"domain\username"}}.

    But I am not able to read the output thro' Dictionary.

    Pls let me know how to implement in Sharepoint designer workflow for reading Sharepoint UserProfile REST API JSON output.

    Thanks

    Rajkumar V


    • Edited by Rajkumar VN Thursday, November 28, 2013 3:04 PM
    Thursday, November 28, 2013 2:49 PM

Answers

All replies

  • Hi,

    According to your post, my understanding is that you want to output the JSON data through a Dictionary.

    In order to achieve that, we can add a Build Dictionary action and add variables to the dictionary.

    More information are provided in the links below:
    http://rogereriksen.wordpress.com/2013/05/24/create-a-sharepoint-site-using-rest-in-workflow-with-sharepoint-designer/
    http://fabiangwilliams.wordpress.com/tag/json/

    Best Regards

     

    Dennis Guo
    TechNet Community Support

    Friday, November 29, 2013 8:01 AM
    Moderator
  • There is a action available To get

     manager name outofbox in SharePoint designer.


    jayant prabhakar

    Friday, November 29, 2013 8:22 AM
  • Hi,

    Thanks for reply, Here I am using Sharepoint 2013 Workflow Type. So pls tell me how to get the value from JSON output.

    For list item we can use  "d/results(0)/Title" to get value from Title column. Like this way what will be the syntax for getting value form "GetUserProfilePropertyFor" REST API using Sharepoint Designer Workflow 2013 Type.

    I got the JSON format as mentioned below (taken from fiddler), but not able to get using Sharepoint Designer Workflow Action "Get an Item from Dictionary".

    {"d":{"GetUserProfilePropertyFor":"domain\username"}} - JSON output


    Rajkumar V

    Friday, November 29, 2013 9:51 AM
  • Hi,

    I got resolved the issue by following steps:

    1. URL to get User Manager "http://<site_URL>/_api/SP.UserProfiles.PeopleManager/GetUserProfilePropertyFor(accountName=@v,propertyName='Manager')?@v='domain\username' " in "APP Step"
    2. Use "d/GetUserProfilePropertyFor" in Get item from a dictionary action
    3. Added "Authorization" Request Header with empty value to avoid "Unauthorized" issue in "App Step"

    Thanks for the Support.


    Rajkumar V

    Friday, November 29, 2013 11:29 AM
  • I have a challenge question for this:

    I'm doing this against O365 SharePoint cloud site.  How does one form the Authorization header in this case?  O365 cloud means federated authentication.  Is it still "Basic" or something else?  does it take the same form?  I've already tried putting a cookie in place with FedAuth and rtFa - no good there. 

    Thursday, December 12, 2013 3:16 PM
  • Hi Rajkumar,

    I've been working on this issue for a long time and still fail.

    I also post a article in the forum: http://social.msdn.microsoft.com/Forums/sharepoint/en-US/da02f0b0-a690-431b-9406-a3fe36a732a3/how-to-use-http-web-service-action-of-sharepoint-2013-designer-to-get-userprofiles?forum=sharepointcustomization#da02f0b0-a690-431b-9406-a3fe36a732a3

    Could you please help me to see what's wrong with me?

    Thank you!!

    Tuesday, January 7, 2014 9:29 AM
  • Hi

    I need to get the manager of the current user. so I tried with below web service call

    https:<siteUrl>/_api/SP.UserProfiles.PeopleManager/GetMyProperties/ExtendedManagers

    for testing I tried it in the browser and it returns:

    {
        "d": {
            "ExtendedManagers": {
                "__metadata": {
                    "type": "Collection(Edm.String)"
                },
                "results": [
                    "i:0#.f|membership|XXXXXX@xxxx.com"
                ]
            }
        }
    }

    can anyone help me to get the XXXXXX@xxxx.com (result) into a SPD workflow variable using "Call HTTP Web service" Action.

    Thanks

    Tuesday, March 24, 2015 5:38 AM
  • Hi,

    once I print the json output to history log it gives an access denied error. 

    "Responce {"error":{"code":"-2147024891, System.UnauthorizedAccessException....."

    I have tried below options as well,

    1. Adding "Authorization" Header with Empty value.
    2. Registering workflow with "Appenv.aspx" and giving it App Permission
    3. Using a app step in a workflow. 

    But still im getting the same error. 

    please advice. 

    Thursday, March 26, 2015 4:56 AM
  • The important part is that you must request access specifically to the social features when you add your Permissions Request XML for the workflow app. I see a lot of blog posts covering how to elevate permissions to work with list items, and they all include XML to give Full Control on the appropriate scope for that alone. To call the UserProfiles endpoint, you need to request access to the "social" scope with this XML: 

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

    A step-by-step example can be found on my blog post.

    Tuesday, May 19, 2015 1:23 PM