Sp-dev-docs: Renaming a folder is tricky; would be a good addition to this article

Created on 3 Jul 2018  Â·  4Comments  Â·  Source: SharePoint/sp-dev-docs

The example "update a folder by using the MERGE method" posts JSON including 'Name': 'New name' which might lead readers to think they can rename a folder that way. It didn't work for me, instead I had to update the associated list item to rename the folder. Specifically:

GET https://site url/GetFolderByServerRelativeUrl('server relative URL of folder')/ListItemAllFields

From this, obtain the odata.type, such as SP.Data.Shared_x0020_DocumentsItem. Then POST to the same URL, using the same headers as in the folder update example and the following JSON:

{
'__metadata': {
'type': 'SP.Data.Shared_x0020_DocumentsItem'
},
'Title': 'New name',
'FileLeafRef': 'New name'
}


Document Details

⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

docs-comment help wanted fixed

All 4 comments

Didn't see your comment till after I figured out what the problem was. Wasted about a day on this. Microsoft's guidance up above on updating a folder is misleading and I wish they would fix their code to accommodate their guidance or update their guidance.

Since leaving this comment, Microsoft has open sourced the documentation and now I was able to submit a pull request to change it. With any luck the correction will go live soon. Meanwhile, @genteelish I'm glad the comment helped though my sympathy for the time wasted ... I spent several hours figuring it out as well!

Can we please get Power Automate screenshots in here for each of the flows? It's not easy to translate the text-only format into the Graphical User Interface of Power Automate.

Issues that have been closed & had no follow-up activity for at least 7 days are automatically locked. Please refer to our wiki for more details, including how to remediate this action if you feel this was done prematurely or in error: Issue List: Our approach to locked issues

Was this page helpful?
0 / 5 - 0 ratings

Related issues

StfBauer picture StfBauer  Â·  3Comments

mikeparkie picture mikeparkie  Â·  3Comments

thechriskent picture thechriskent  Â·  3Comments

SteIvanov picture SteIvanov  Â·  3Comments

ken-harris picture ken-harris  Â·  3Comments