cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
annetoal
Super User
Super User

URI for finding locked files

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

annetoal_1-1641406633666.png

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

3 ACCEPTED SOLUTIONS

Accepted Solutions
Jronash
Impactful Individual
Impactful Individual

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

View solution in original post

Expiscornovus
Super User
Super User

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'

 



Happy to help out! 🙂

Interested in more #PowerAutomate #SharePointOnline or #PowerVirtualAgents content?
Visit my blog, Subscribe to my YouTube channel or Follow me on Twitter


View solution in original post

Expiscornovus
Super User
Super User

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

 



Happy to help out! 🙂

Interested in more #PowerAutomate #SharePointOnline or #PowerVirtualAgents content?
Visit my blog, Subscribe to my YouTube channel or Follow me on Twitter


View solution in original post

5 REPLIES 5
Jronash
Impactful Individual
Impactful Individual

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
Expiscornovus
Super User
Super User

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'

 



Happy to help out! 🙂

Interested in more #PowerAutomate #SharePointOnline or #PowerVirtualAgents content?
Visit my blog, Subscribe to my YouTube channel or Follow me on Twitter


Here's what I currently have.

annetoal_0-1641482390606.png

 

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

Expiscornovus
Super User
Super User

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

 



Happy to help out! 🙂

Interested in more #PowerAutomate #SharePointOnline or #PowerVirtualAgents content?
Visit my blog, Subscribe to my YouTube channel or Follow me on Twitter


Rishab_16
Microsoft
Microsoft

 

 

Helpful resources

Announcements
Power Automate News & Announcements

Power Automate News & Announcements

Keep up to date with current events and community announcements in the Power Automate community.

Community Calls Conversations

Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Automate Community Blog

Power Automate Community Blog

Check out the latest Community Blog from the community!

Users online (3,976)