Description
The following script throws an error:
m365 file list --folderUrl "/sites/somesite/Shared Documents/" --webUrl "https://contoso.sharepoint.com/sites/somesite" --verbose
While excluding the trailing slash does work:
m365 file list --folderUrl "/sites/somesite/Shared Documents" --webUrl "https://contoso.sharepoint.com/sites/somesite" --verbose
CLI for Microsoft 365 version
6.4 (next)
nodejs version
16.15.0
Operating system (environment)
Windows
Shell
PowerShell
Additional Info
The error is caused by the url manipulation here. documentLibraryRelativeFolderUrl probably contains /. Which causes the URL to include root: instead of the expected root.
const documentLibraryRelativeFolderUrl: string = folderUrl.href.replace(new RegExp(documentLibrary.webUrl as string, 'i'), '');
const requestOptions: CliRequestOptions = {
url: `${this.resource}/v1.0/drives/${documentLibrary.id}/root${documentLibraryRelativeFolderUrl.length > 0 ? `:${documentLibraryRelativeFolderUrl}` : ''}?$select=id`,
headers: {
accept: 'application/json;odata.metadata=none'
},
responseType: 'json'
};
Description
The following script throws an error:
While excluding the trailing slash does work:
CLI for Microsoft 365 version
6.4 (next)
nodejs version
16.15.0
Operating system (environment)
Windows
Shell
PowerShell
Additional Info
The error is caused by the url manipulation here.
documentLibraryRelativeFolderUrlprobably contains/. Which causes the URL to includeroot:instead of the expectedroot.