Forum Discussion

GACVizDesign's avatar
GACVizDesign
Copper Contributor
Dec 08, 2020

Rename Folder Error

Good Evening All! 

I am working on creating a flow to duplicate a predetermined folder structure and then rename the folder based on a MS Forms submission.  I have the folder duplication into the correct location working correctly, however I cannot seem to fix the renaming step.  Each time I submit, I get the following error:

 

The expression "web/GetFolderByServerRelativeUrl(‘Completions Accounts/G550/Standard Folder Structure’)/ListItemAllFields" is not valid.
clientRequestId: 03bedea0-b37e-43cc-876a-f459bf8c6a68
serviceRequestId: 5823959f-e0a9-b000-a059-014d61aebc56

 

Any ideas??  Thank you!

  • yenijc's avatar
    yenijc
    Dec 10, 2020

    GACVizDesign 

     

    I see that you are using the default document library in the site which is the Documents. In your Uri, you should only write the document library's name in the getbytitle part: _api/web/lists/getbytitle('Documents')/items([ItemId here]). If you did not change the display name of your document library, that should work. However, if you changed it, please change the Documents to your document library's current display name. 

     

     

    and for the Body, the metadata type should be SP.Data.Shared_x0020_DocumentsItem

     

    {
    	"__metadata": {
    		"type": "SP.Data.Shared_x0020_DocumentsItem"
    	},
    	"FileLeafRef": "Folder Name"
    }

     

     

    Your http request action should look like this:

     

    Hope that helps.

  • yenijc's avatar
    yenijc
    Copper Contributor

    Hello GACVizDesign 

     

    You can use this rest in your Uri: 

    _api/web/lists/getbytitle('[Document Library Name Here]')/items([Folder ID Here])

    Use the itemId return from the Copy Folder action as the Folder ID.

     

    In the Body, you should also specify the metadata type. You can check the screenshot below.

     

     

     

     

    • GACVizDesign's avatar
      GACVizDesign
      Copper Contributor

      Thank youyenijc !

      I cannot seem to figure out how to pull the ItemID / FolderID from the previous step... any thoughts on how to facilitate that step??  Thanks again!

      • yenijc's avatar
        yenijc
        Copper Contributor

        Hi GACVizDesign ,

         

        When you put your cursor in the Uri, there are suggestions in what you can add. Under Dynamic content, look for the previous action step's name which is Copy Folder, then select ItemId. 

         

        If you have many actions already in your flow and it's difficult to find the ItemId, you can just search it.

         

         

Resources