pnp/PnP

Add-PNPFile and Copy-PNPFile don't work for "Link to Document" content types

Opened this issue · 0 comments

Thank you for reporting an issue or suggesting an enhancement. We appreciate your feedback - to help the team to understand your needs, please complete the below template to ensure we have the necessary details to assist you. If you have a actual question, we would ask you to use SharePoint Developer Group at Microsoft Tech Community. Thanks!

Category

[X] Bug
[ ] Enhancement

Environment

[X] Office 365 / SharePoint Online
[ ] SharePoint 2016
[ ] SharePoint 2013

If SharePoint on-premises, what's exact CU version:

Expected or Desired Behavior

If you are reporting a bug, please describe the expected behavior. If you are suggesting an enhancement please
describe thoroughly the enhancement, how it can be achieved, and expected benefit.

Create a "Link to Document" document using PNP Powershell.

Observed Behavior

If you are reporting a bug, please describe the behavior you expected to occur when performing the action. If you are making a suggestion, you can delete this section.

Have tried to do this multiple ways - all fail:

  1. Using Add-PNPFile with a template file (downloaded a working file from SPO) with the -ContentType switch fails with an error about the Folder not being found
  2. Using Add-PNPFile with a template file (downloaded a working file from SPO) without the -ContentType switch but with the desired contenttype as the library default creates what appears to be a Link to Document (file and icon are correct) but SPO attempts to download the file instead of doing the redirect.
  3. Using Add-PNPFile with a template file (downloaded a working file from SPO) without the -ContentType switch then subsequently updating the contenttype and/or metadata using Set-PNPListItem results in the same behavior as #2.
  4. Using Copy-PNPFile to attempt to copy a working Link to Document from another document library in the same web results in "Cannot contact site at the specified URL" and lists the full URL of the source file. The URL displayed is correct. Tried both Site and Server relative URLs for source and got the same results.

Steps to Reproduce

If you are reporting a bug please describe the steps to reproduce the bug in sufficient detail to allow testing. Only way to fix things properly, is to have sufficient details to reproduce it. If you are making a suggestion, you can delete this section.

See above.