@Expiscornovus I've been using the method you outlined in this post, and I've observed that it's not always consistent when vti_sourcecontrollockid appears in the MetaInfo field. I'm running a test where I open a Word file, then I run a flow on that file that tries to determine if the file is locked. Sometimes, contains vti_sourcecontrollid, sometimes it has this instead.
"MetaInfo": "xxxx;#Document1 - Copy.docx;#xxxx;#\"{xxxx},1\";#\"{xxxx},2\";#0x0269B10526D4DBE0FAFC3496C557C2C7F7589AEEE8;#20791;#0\r\nvti_iplabelpromotionmoduleversion:IR|3\r\nvti_dbschemaversion:SR|16.0.333.0\r\nvti_priorversioncreationtime:TR|31 Mar 2023 15:04:02 -0000\r\nvti_timelastwnssent:TR|03 Apr 2023 16:05:10 -0000\r\n_Status:EW|\r\nvti_cobalt_NewInSession_i\\:0#.f|membership|user1@mail.edu:SW|true\r\nDocument type:EW|\r\nvti_foldersubfolderitemcount:IR|0\r\nvti_ZeroByteFileIsOverwriteable:SW|false\r\nvti_title:SW|\r\nvti_contentchangeunit:SW|\r\n_ip_UnifiedCompliancePolicyUIAction:EW|\r\nvti_iplabelpromotionversion:IW|0\r\nComments:EW|\r\n_Comments:SW|\r\nvti_streamSyncTokenSequenceNumber:IW|267\r\nvti_areHybridOrphanHashedBlobsCleaned:BW|false\r\nDept. Group:EW|\r\nDepartment owner:EW|\r\nvti_mediaserviceofficebundlegenerated:SW|TRUE\r\nvti_mediaservicemetadata:SW|{\"ctag\":\"\\\\\"c:{xxxx},26\\\\\"\",\"generationTime\":\"2023-03-31T15:09:23.3520182Z\",\"buildVersion\":\"media_prod_22709858_031623.1_03-16-2023-workerrole\",\"lastStreamUpdateTime\":\"2023-03-31T15:09:23.3520182Z\",\"modules\":[{\"module\":\"AIPLabelExtract\",\"version\":3},{\"module\":\"DocxParser\",\"version\":1},{\"module\":\"TimeToRead\",\"version\":1},{\"module\":\"OfficeBundleGeneration\",\"version\":1}],\"billedEvents\":[],\"document\":{\"language\":\"en\",\"extension\":\"docx\"},\"officeBundle\":{\"ctag\":\"\\\\\"c:{7e2de4e8-8156-4398-835c-e9104bb2ebc0},26\\\\\"\",\"fatalError\":false,\"version\":\"4.1632930951\",\"generationTime\":\"2023-03-31T15:09:23.0395164Z\",\"generationReason\":\"AnalysisPipeline\"},\"timeToRead\":0}\r\nvti_parserversion:SR|16.0.0.23515\r\nreviewComplete:BW|false\r\n_ip_UnifiedCompliancePolicyProperties:EW|\r\nreviewNotice:FX|0x01da5d78|0xb67db000\r\nvti_TimeOfLastCobaltVersionCreation:TW|31 Mar 2023 15:04:02 -0000\r\nvti_decryptskipreason:IW|1\r\n_Category:EW|\r\nreviewDue:FX|0x01da8003|0x9ee64800\r\nvti_sprocsschemaversion:SR|16.0.837.0\r\nvti_cobalt_NewInSession_i\\:0#.f|membership|user2@mail.edu:SW|true\r\nvti_modifiedby:SR|i:0#.f|membership|user2@mail.edu\r\n"
This has led me to read more on SharePoint file locking and I've noticed that it is variable when SharePoint locks and unlocks a file, and it seems variable when SharePoint knows the name of the user who locked the file.
For instance, some of the time, MetaInfo contains vti_sourcecontrollockid (it thinks the file is locked), but the LockedByUser shows as null (it can't identify who locked the file).
Also, there seems to be a delay between when you close a file and when SP detects the file is closed. And finally, there are certain files that once opened, SP never again reports them as closed. You might have to go to the extreme of copying the file contents into another file just to get a copy of the file that SP treats as unlocked.
I was wondering if you have any similar experiences to share, or maybe commiserate with me.
I'm still trying to get a handle on when a SP file is locked and find a consistent method to identify the locking user.
Thanks,
Anne