Forum Discussion

TheHailender's avatar
TheHailender
Brass Contributor
Jan 15, 2020

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

  • DavidShvartsman's avatar
    DavidShvartsman
    Copper Contributor

    TheHailender 

    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()

     

Resources