SharePoint Architect & Developer Advanced REST API & SharePoint: Manage Permissions with Workflows (SharePoint Online, SharePoint Designer) Nicholas Miller SharePoint Architect & Developer
Agenda Brief Review of the Rest API & Web Services Preparation for building Workflows using Web Services Manage List/Library Item Permissions via Rest Concept of Central Mapping List for User Access Lessons Learned Questions
Brief Review of the Rest API & Web Services
Examples of Rest API in IE Role Definitions (All Fields)
Examples of Rest API in IE Role Definitions (Select Properties)
Examples of Rest API in IE SharePoint List (All Properties)
Examples of Rest API in IE SharePoint List (Select Data)
Workflow Designer – Properties “Call HTTP Web Service” Action Address – String RequestType – Built in selection for: HTTP DELETE HTTP GET HTTP POST HTTP PUT RequestHeaders – Dictionary RequestContent – Leave Blank on most Web Service Calls ResponseContent – Dictionary ResponseHeaders – Dictionary ResponseCode - String The variables for this action can be used extensively for debugging. After your web service call, you can e-mail yourself with this information to see what data was returned and any errors normally not seen. The Results are returned in JSON.
E-mail Example for Debugging
Preparation for building workflows using Web Services
Method to the Madness 60% Design, 30% Develop, 10% Deploy T.O.T.B. Think Outside The Box Start with the “Pie in the Sky” for the Business User, as most project’s scope tends to creep Map out Current and Future States Identify sub-workflow processes (if needed) Identify potential hazards Embrace 3rd Party Applications for SharePoint Plumsail (https://plumsail.com/) Plumsail – Workflow Actions Pack (https://plumsail.com/workflow-actions-pack/) SharePoint Designer 2013 Platform workflows only 30% Develop Develop each part of the sub-workflow processes prior to developing main workflow to ensure success Plan your logic cleanly Use History List logging and E-mails for debugging 10% Deploy Deploy finished product into your production environment, test with business users, and walk-away successful
Method to the Madness 60% Design, 30% Develop, 10% Deploy Tips & Reminders Stages, Steps, & Variables are your Best Friends! Build & Set your variables first RestURLs, Permission Levels, String-Variables for items retrieved from dictionaries, various dictionaries for the Call Action, String-Variables for Security/SharePoint Group IDs, etc. Taking the time to build and use variables in your workflow in the beginning makes updating and trouble-shooting easy Organize your Stages and Steps to keep actions together Enable the “App Step” feature in your site, as you will need it POST calls require the App Step GET calls require NOT to be in an App Step
Method to the Madness 60% Design, 30% Develop, 10% Deploy Tips & Reminders Use e-mail to debug the Rest Call Build 1 Rest Call, and test until it is right, then Copy and paste the reminder of the calls, changing the variables Log to the History list during initial development, but remove most of them when deploy to minimize the number of Outbound Workflow Service calls Limit of 5,000 Outbound request to the Workflow Service, per workflow instance, per SharePoint Site in a 24-hour period (KB-3076399) 24-hour clock starts when the instance is created Final Stage should be “Log End of Workflow” This allows you to set the workflow status to “Complete”, along with entering any final logging
Manage List/Library Item Permissions via Rest
Move into SharePoint Designer and build out the workflow
Concept of Central Mapping Lists for User Access
Holiday Communities & Accesses 4 Districts 32 Regions 308 Communities All Communities, Regions, and Districts have specific access requirements maintained by AD Security Groups. Having a mapping list with these groups populated makes using the Web Service action assigning specific access dynamic and automated across a multitude of SharePoint lists, Libraries, and customized InfoPath Forms.
Example of using Rest API in obtaining Specific District/Region/Community Access
Example of Permission Updates Using REST Lookup Move into SharePoint Designer to show the workflow and demo in SPList
Lessons Learned
Use OneNote for quick reference Workflow Service throttling Get_RequestHeaders dictionary specifics, RestURLs, frequently used Security and SharePoint Group IDs, Permission Level IDs (Role Definitions ), etc. Workflow Service throttling GET requests return batches of 100, so using loops and count actions are needed updating lists with more than 100 items. Build 1 Web Service call, publish, and test with e-mail debugging Ensure you have given your workflows the appropriate permissions Iron out all the wrinkles with your first call from errors, getting items from dictionaries, etc. Once satisfied, build out the other Web Service calls Use Stages and Steps to group the types of calls GET requests and Individual Items from that call POST requests (in an App Step) together Log to the history list at the end of each step to ensure the workflow is hitting all areas needed for the specific scenario
Questions???
Nicholas Miller SharePoint Architect & Developer Holiday Retirement nicholas.miller@holidaytouch.com