Powershell Add-PnPFile and version history error?

Copper Contributor


I’m uploading multiple files to a SharePoint Online Document Library which has versioning enabled (create major versions is active) while content approval and require check out are disabled.

In general I’m using following statement:

Add-PnPFile -Path "<path>\<MyDoc>.docx" -Folder $targetDocLib -Values @{Title="test titel"}


As a result I have two versions of the document within my SPO DocLib.



If I try to open the documents out of the version history I face following issues:

  • The documents are opened within my locally installed client application. This does not reflect my settings because all documents should open within the browser
  • I get following error when I open Version 2.0 (which is the current version.). Unable to open link https://<tenant>/sites/<sitename>/<targetDocLib>/MyDoc.docx

The link itself is correct and I’m able to open the document out of the library. Also, the issue appears only on MS Office Documents and not with .txt or .pdf files.

Therefore I’m wondering if anyone has seen this before?



0 Replies