Skip to content

Update spo folder move endpoint #5331

@milanholemans

Description

@milanholemans

While working on #4968 I noticed that it's not possible to use special characters # and % in the URL of the source or destination path of the command spo folder move. Just like we did with spo file copy we should look for another API endpoint that does support it. This will likely cause breaking changes.


Options

Option Description
-u, --webUrl <webUrl> The URL of the site where the folder is located.
-s, --sourceUrl [sourceUrl] Site-relative, server-relative or absolute URL of the folder. Specify either sourceUrl or sourceId but not both.
-i, --sourceId [sourceId] The UniqueId (GUID) of the folder. Specify either sourceUrl or sourceId but not both.
-t, --targetUrl <targetUrl> Server-relative URL where to move the folder.
--newName [newName] New name of the destination folder.
--nameConflictBehavior [nameConflictBehavior] Behavior when a file or folder with the same name is already present at the destination. Possible values: fail, rename. The default is fail.
--retainEditorAndModified Use this option to retain the editor and modified date. When not specified, these values are reset.
--bypassSharedLock This indicates whether a folder with a shared lock can still be moved. Use this option to copy a folder that is locked.

I'm not sure if bypassSharedLock is something that can be used for a folder.

We should also drop a few options that are no longer needed or that are not supported by the API.

  • allowSchemaMismatch --> not supported by the API

API request

POST https://contoso.sharepoint.com/_api/SP.MoveCopyUtil.MoveFolderByPath
{
    "srcPath": {
        "DecodedUrl": "https://contoso.sharepoint.com/sites/project-x/TestLib/My Folder"
    },
    "destPath": {
        "DecodedUrl": "https://contoso.sharepoint.com/sites/project-x/TempLib/My Folder2"
    },
    "options": {
        "KeepBoth": false,
        "ShouldBypassSharedLocks": true,
        "RetainEditorAndModifiedOnMove": false,
    }
}

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions