Tag Archives: SharePoint Folders
Renaming SharePoint Folder using Microsoft Flows
Introduction: Using MS Flows, On any trigger, you can add the below action to rename the SharePoint folder. Steps: 1) In Actions, select “Send an HTTP request to SharePoint” 2) Enter the below details: Site Address: Select your site address from the list. Method: POST Uri:_api/web/GetFolderByServerRelativeUrl(‘LibraryTitle/CurrentFolderName’)//ListItemAllFields Headers: Accept application/json;odata=verbose X-HTTP-Method MERGE If-Match * Body: { Title :”New Name of Folder” FileLeafRef’:”New Name of Folder” } 3) The Folder Name in Uri and new folder names in body can be dynamic as per your requirement( Refer Screenshot below: the data here is taken directly from the trigger when file is created in SharePoint). Sample Output: Conclusion: Simple SharePoint Connector in MS Flows can help to rename a SharePoint Folder.
Create SharePoint Folder using POST request in MS Flows
Introduction: This blog explains how to create folders in SharePoint when new record is created in D365 CE. Use Case: When new account is created in D365 CE create āContact Documentsā and āDocumentsā folders in SharePoint. Pre-Requisites: D365 CE SharePoint Online Microsoft Flow Steps to be followed: Sign in to the Microsoft flow. https://flow.microsoft.com/en-us/ Go to My flows -> ā+Newā-> ā+Automated-from blank” 3. Select āWhen a record is createdā trigger and click on create. 4. Select āOrganization Nameā and āEntity Nameā. 5. Click on ā+New Stepā and select āComposeā Action. 6. a. Add āAccount Nameā from Dynamics Content in Input. b. Add underscore ā_ā c. Click on Expression enter below formula: toUpper(replace(triggerBody()?[‘accountid’],’-‘,”)) d. Compose should look like below: 7. Now we will create āMain folder in SharePointā for this account. 8. Click on ā+New stepā and select āSend an HTTP request to SharePointā Action. 9. Enter below details: Site Address: Select the site address from the list. Method: POST Uri: _api/Web/GetFolderByServerRelativeUrl(‘account/Output of Compose‘)/Folders Headers: Content-Type application/json;odata=verbose Accept application/json;odata=verbose Body: { ‘__metadata’: { ‘type’: ‘SP.Folder’ }, ‘ServerRelativeUrl’:’account/ Output of Compose‘} 10. Now we will create sub folders inside the main folder. 11. Click on ā+New stepā and select āSend an HTTP request to SharePointā Action. 12. Enter below details: Site Address: Select the site address from the list. Method: POST Uri: _api/Web/GetFolderByServerRelativeUrl(‘account/Output of Compose/Contact Documents‘)/Folders Headers: Content-Type application/json;odata=verbose Accept application/json;odata=verbose Body: { ‘__metadata’: { ‘type’: ‘SP.Folder’ }, ‘ServerRelativeUrl’:’account/ Output of Compose/Contact Documents‘} NOTE: āContact Documentsā is the sub folder which we want to create in main folder. 13. Repeat “step no 12” to create āDocumentsā folders. Uri: _api/Web/GetFolderByServerRelativeUrl(‘account/Output of Compose/ Documents‘)/Folders Body: { ‘__metadata’: { ‘type’: ‘SP.Folder’ }, ‘ServerRelativeUrl’:’account/ Output of Compose/ Documents‘} NOTE: āDocumentsā is the sub folder which we want to create in main folder. Complete Flow: Testing Flow Create new account record in D365 CE. Check Documents in SharePoint.