# Get document by SharingDocId with Powershell

Occasional Contributor

# Get document by SharingDocId with Powershell

Hi,

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

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.
Does anyone have an idea?

Bye
Jens
1 Reply

# Re: Get document by SharingDocId with Powershell

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

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