0

I know we can add link to a document in the document library . Is there a way to do the same using pnp js ?

1 Answers1

0

If you mean can you create a .url file using PnP, the answer is yes. Here is how I did it:

$link = 'https://some-link.com' 
$name = 'name this link'
$lib = 'Document Library'

$memoryStream = [IO.MemoryStream]::new([Text.Encoding]::UTF8.GetBytes("[InternetShortcut]`nURL="+$row.link))
Add-PnPFile -FileName $name -Folder $library -Stream $memoryStream -Publish      

Donald Koscheka
  • 336
  • 1
  • 6