Get document by SharingDocId with Powershell

Occasional Contributor


I found the hidden list "Sharing Links" on a SharePoint site. 

2020-01-15 10_16_41-Windows PowerShell ISE.png

It seems that all shared links are stored in this list. Now my question: How do I get to the shared document using this link? I assume that the SharingDocId references the document.
2020-01-15 10_17_41-Windows PowerShell ISE.png
Does anyone have an idea?
1 Reply


SharingDocId is Document UniqueId of the Document/folder in the document libraries 

$SharingDocId = "<SharingDocId>"
$Ctx = Get-PnPContext
$file = $ctx.Web.GetFileById($SharingDocId)