Hello,
In Locked file checking pattern in Power Automate • Tomasz Poszytek, Business Applications MVP I read about using HTTP requests to determine which files are locked in a SharePoint Library.
However, something is wrong with the way I am transcribing the URI from Tomasz' tutorial. Here's my URI:
/_api/Web/GetFileByServerRelativePath('sites/xxx/yyy/zzz')/LockedByUser
The error generated is
<?xml version="1.0" encoding="utf-8"?><m:error xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"><m:code>-1, Microsoft.SharePoint.Client.InvalidClientQueryException</m:code><m:message xml:lang="en-US">Cannot deserialize data for type Microsoft.SharePoint.SPResourcePath.</m:message></m:error>
What have I got wrong?
Thanks,
Anne
Solved! Go to Solution.
To me, the error message suggests that SharePoint is having trouble understanding your path in the ...ServerRelativePath('...') query. Double-check to make sure you don't have any typos there.
Also, don't know if this would make a difference or not, but you capitalized the L in 'LockedByUser'. In the tutorials you linked to, it's lower case:
lockedByUser
Hi @annetoal,
In addition to @Jronash, as far as I can tell Tomasz is using the x-ms-file-path property in his example to retrieve the lock status of a single file.
Normally that would be a value like /LibraryName/DocumentName.docx. Are you using the file name and extension in your getfilebyserverrelativepath?
So that would probably be:
'sites/xxx/yyy/zzz/LibraryName/DocumentName.docx'
Hi @annetoal,
Thank you for sharing that additional information.
Just to double check, the site address has a slash between yyy and zzz. Is zzz a subsite of the yyy site?
Based on what I have seen so far in the screenshots I would say the URI value would be something like this:
_api/Web/GetFileByServerRelativePath('sites/yyy/zzz/IT%20Document%20Repository/Test/CountryPops.xlsx')lockedByUser
To me, the error message suggests that SharePoint is having trouble understanding your path in the ...ServerRelativePath('...') query. Double-check to make sure you don't have any typos there.
Also, don't know if this would make a difference or not, but you capitalized the L in 'LockedByUser'. In the tutorials you linked to, it's lower case:
lockedByUser
Hi @annetoal,
In addition to @Jronash, as far as I can tell Tomasz is using the x-ms-file-path property in his example to retrieve the lock status of a single file.
Normally that would be a value like /LibraryName/DocumentName.docx. Are you using the file name and extension in your getfilebyserverrelativepath?
So that would probably be:
'sites/xxx/yyy/zzz/LibraryName/DocumentName.docx'
Here's what I currently have.
I need some further explanation. Is the output of this connector really supposed to produce a URL that looks like this?
https://xxx.sharepoint.com/sites/yyy/zzz/_api/Web/GetFileByServerRelativePath('IT%20Document%20Repository/Test/CountryPops.xlsx')lockedByUser
Error message:
<?xml version="1.0" encoding="utf-8"?><m:error xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"><m:code>-1, Microsoft.SharePoint.Client.InvalidClientQueryException</m:code><m:message xml:lang="en-US">The expression "Web/GetFileByServerRelativePath('IT Document Repository/Test/CountryPops.xlsx')lockedByUser" is not valid.</m:message></m:error>
clientRequestId: aaa
serviceRequestId: bbb
Is that ('___') really supposed to be in the Uri?
Thanks for staying with me,
Anne
@Jronash @expiscornovus
Hi @annetoal,
Thank you for sharing that additional information.
Just to double check, the site address has a slash between yyy and zzz. Is zzz a subsite of the yyy site?
Based on what I have seen so far in the screenshots I would say the URI value would be something like this:
_api/Web/GetFileByServerRelativePath('sites/yyy/zzz/IT%20Document%20Repository/Test/CountryPops.xlsx')lockedByUser
User | Count |
---|---|
88 | |
37 | |
25 | |
13 | |
13 |
User | Count |
---|---|
121 | |
55 | |
36 | |
24 | |
21 |