Skip to main content

Move SharePoint List Item to Folder when new item created Power Automate


 My biggest challenge I got stuck on for days was to get items saved in folders, as we all know new items, when  created from Power App or customized form do not get saved in folder, but in main list outside the folder structure, making it visible and editable by all.

I dug internet for solution and today found video, which helped me a lot!

Thank you Deepak Shrivastava for a video.

Move SharePoint List Items Using Power Automate #PowerAutomate #SharePoint - YouTube

The how to very well explained, so I will not repeat,  just added  typed code strings and a screenshot of my version

ItemPath

decodeUriComponent(decodeUriComponent(decodeUriComponent(triggerOutputs()?['body/{Identifier}'])))

Filter Query
Title eq'@{triggerOutputs()?['body/Warehouse/Value']}'

Folder Path
decodeUriComponent(decodeUriComponent(decodeUriComponent(outputs('Get_items')?['body/value'][0]?['{Identifier}'])))

Though I followed the video to a dot, I was not able to get it flow.

After tweaking code in final Output, it finally worked for me

{

  "srcPath": {

    "__metadata": {

      "type": "SP.ResourcePath"

    },

    "DecodedUrl": "https://pinkeyecrow.sharepoint.com/sites/EPOS/@{outputs('ItemPath')}"

  },

  "destPath": {

    "__metadata": {

      "type": "SP.ResourcePath"

    },

    "DecodedUrl": "https://pinkeyecrow.sharepoint.com/sites/EPOS/@{outputs('FolderPath')}/@{triggerOutputs()?['body/ID']}_.000"

  }

}




_api/SP.MoveCopyUtil.MoveFileByPath(overwrite=@a1)?@a1=true
Accept
application/json; odata=nometadata
Content-Type
application/json; odata=verbose
Enter key

Enter value

Outputs




Comments