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 copy. 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. |
-i, --sourceId [sourceId] |
The UniqueId (GUID) of the folder. Specify either sourceUrl or sourceId but not both. |
-s, --sourceUrl [sourceUrl] |
Site-relative, server-relative or absolute URL of the folder. Specify either sourceUrl or sourceId but not both. |
-t, --targetUrl <targetUrl> |
Server-relative URL where to copy 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. |
--resetAuthorAndCreated |
Use this option to clear the author and created date. When not specified, the values from the source folder are used. |
--bypassSharedLock |
This indicates whether a folder with a shared lock can still be copied. 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.CopyFolderByPath
{
"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,
"ResetAuthorAndCreatedOnCopy": false
}
}
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 commandspo folder copy. Just like we did withspo file copywe should look for another API endpoint that does support it. This will likely cause breaking changes.Options
-u, --webUrl <webUrl>-i, --sourceId [sourceId]sourceUrlorsourceIdbut not both.-s, --sourceUrl [sourceUrl]sourceUrlorsourceIdbut not both.-t, --targetUrl <targetUrl>--newName [newName]--nameConflictBehavior [nameConflictBehavior]fail,rename. The default isfail.--resetAuthorAndCreated--bypassSharedLockI'm not sure if
bypassSharedLockis 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 APIAPI request