My Flow takes into consideration that you have installed on-premises data gateways for Microsoft Flow.
Follow https://docs.microsoft.com/en-us/flow/gateway-reference for more details.
Microsoft flow
Step 1: Trigger : When a file is created in a folder. Where /FinalDocuments is the name of the SharePoint Document Library.
Step 2: Delay ( Just in case )
Step 3: Get file metadata
Step 4 : Get item ( where ItemId is from previous step)Requirement was to create Folder name in netdocuments with ClientName-CurrentYear. Where ClientName is the Column in SharePoint.
Step 5: Compose Action
FormatDateTime Formula - formatDateTime(utcNow(),'yyyy')
Create Folder in netdocuments is a premium connector available. Please check your licensing before utilizing this Connector.
Step 6 : Create folder
Every workspace under netdocuments have a Parent ID associated.
In order to perform query without caring about the namespace, you can use local-name().
Following article helped me with this
https://powerusers.microsoft.com/t5/Building-Flows/Using-xPath-on-an-HTTP-xml-body/td-p/73531
Step 7 : Compose Action
Step 8 : We need to get ID from the XML.
Formula Used:
xpath(xml(outputs('XML')),'string(//*[local-name()="ndProfile.DocumentInformation"]/*[local-name()="standardAttributes"]/*[local-name()="id"]/text())')
Step 9 : Create document in Netdocuments where Destination is the output of Compose 2 Action which would give us the Destination ID.
Save the Flow and run. If it is a success it should create a folder in Netdocuments and move document uploaded in SharePoint document library to that folder.
Thanks for reading!