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 file 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 file is located. |
-i, --sourceId [sourceId] |
The UniqueId (GUID) of the file. Specify either sourceUrl or sourceId but not both. |
-s, --sourceUrl [sourceUrl] |
Site-relative, server-relative or absolute URL of the file. Specify either sourceUrl or sourceId but not both. |
-t, --targetUrl <targetUrl> |
Server-relative URL where to move the file. |
--newName [newName] |
New name of the destination file. |
--nameConflictBehavior [nameConflictBehavior] |
Behavior when a file or folder with the same name is already present at the destination. Possible values: fail, replace, 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 file with a shared lock can still be moved. Use this option to move a file that is locked. |
We should also drop a few options that are no longer needed or that are not supported by the API.
deleteIfAlreadyExists --> is replaced by nameConflictBehavior
allowSchemaMismatch --> not supported by the API
API request
POST https://contoso.sharepoint.com/sites/project-x/_api/SP.MoveCopyUtil.MoveFileByPath
{
"srcPath": {
"DecodedUrl": "https://contoso.sharepoint.com/sites/project-x/TestLib/Book.xlsx"
},
"destPath": {
"DecodedUrl": "https://contoso.sharepoint.com/sites/project-x/TempLib/Book.xlsx"
},
"overwrite": false,
"options": {
"KeepBoth": false,
"ShouldBypassSharedLocks": true,
"RetainEditorAndModifiedOnMove": 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 file move. 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,replace,rename. The default isfail.--retainEditorAndModified--bypassSharedLockWe should also drop a few options that are no longer needed or that are not supported by the API.
deleteIfAlreadyExists--> is replaced bynameConflictBehaviorallowSchemaMismatch--> not supported by the APIAPI request