Ofer Gal
Ofer Gal

Reputation: 883

Who has file open in SharePoint

We have lots of sites and files in SPO In an SPFx webpart, I need to warn the user about a certain file being open by any user.

I use PnP/JS getLockedByUser() function of IFIle type to get the current locked by user. The problem is that I get undefined results for any user other than the current user.

If the file is open by anyone else, the code "think" no one has it open and will fail because the file is open.

Is there a Rest, graph or C# option, to try in an azure function,to check it?

Thanks

Upvotes: 0

Views: 117

Answers (1)

Valentyn Grygoriev
Valentyn Grygoriev

Reputation: 463

I'm not sure if it helps. I use this Uri in Power Automate to get information who locked file in SharePoint online. _api/web/GetFileByServerRelativeUrl('')/lockedByUser. It returns JSON with information about user.

Upvotes: 0

Related Questions