Just wondering if you could help, I am looking to create a link to a file in a document library, essentially replicating this functionality:

New Link

I was hoping it would be simple to do this using PnP PowerShell I have tried the using the Add-PnPFile however this always expects a stream when running the command below.

Add-PnPFile -FileName "Something.url" -Folder "Folder 1"

Appreciate any help or advice that can be given.

1 Answer 1


A demo for your reference:

$stream = [IO.MemoryStream]::new([Text.Encoding]::UTF8.GetBytes("[InternetShortcut]URL=https://www.bing.com"))

Add-PnPFile -FileName "Bing.url" -Folder "Shared Documents" -Stream $stream -Values @{_ShortcutUrl="https://www.bing.com"}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.