Friday, May 4, 2018

Get User Profile data in SharePoint Designer 2013 Workflow



SharePoint Designer 2010 supported out of box activity to access user profile fields. However, User Profile service option is not present in SharePoint 2013 Designer workflows.

In SharePoint 2013 workflow type ,we do not have any Lookup Manager for User activity. For this, SharePoint 2013 workflow you will need to use the Call HTTP Web Service activity, with the following end point URL.




Follow the below steps to get manager:


Step 1 : Activate site level feature - Workflows can use app permissions.

1. Go to Site Settings and click Manage site features under Site Actions.
2. Activate feature Workflows can use app permissions.





Step 2 : App Permission – To ensure that workflow can access user profiles.
1. Go to Site Settings and click Site app permissions under Users and Permissions.
2. Make a note of the App ID for your Workflow – portion of the Workflow App Identifier between | and @.






3.With the tenant/Farm admin account, go to <site-url> /_layouts/15/appinv.aspx.
At the appinv.aspx page, fill in the Application ID and click the search button next to the ID box















































4. Copy below xml to App’s Permission Request XML box,
<AppPermissionRequests> 
   <AppPermissionRequest Scope="http://sharepoint/social/tenant" Right="Manage" /> 

</AppPermissionRequests> 

5. Click Create. 6. Click Trust It, when prompted. 

















Step 3 : Create a Workflow to get user profiles data.
1. Open the site in SharePoint designer and create workflow on designed list or document library.
2. Add app step and Set up a workflow variable emailid  that stores the target user’s login name.









3.We will encode the variable as below.







4.Build dictionary to set up the RequestHeaders









5. Set the values as below to dictionary.



Accept
application/json;odata=verbose
Content-Type
application/json;odata=verbose

6. We will use the REST API to get UserProfile Properties.

7. Set workflow variable servicecall to RESTAPI.





















1 
                 8. Call Http Web Service to invoke the REST API

9







              
9.The workflow variable Manager should get populated with the Title


















10.   Updated one of the list filed with Title.



















No comments:

Post a Comment