Azure automation PNP-Powershell module not able to use function Copy-PnPFile

DNKMK 1 Reputation point
2022-12-12T14:56:12.27+00:00

Does somebody have an issue with the copying of a file in Sharepoint Online withing the same site?

Azure Automation
Azure Automation
An Azure service that is used to automate, configure, and install updates across hybrid environments.
1,366 questions
Microsoft 365 and Office SharePoint For business Windows
{count} votes

1 answer

Sort by: Most helpful
  1. Xyza Xue_MSFT 30,176 Reputation points Microsoft External Staff
    2022-12-13T07:00:42.18+00:00

    Hi @DNKMK ,
    I don't have lisense for Azure Automation, I only have permissions to SharePoint. So I tested this problem from the level of sharepoint and powershell.
    I tested the Copy-PnPFile function with Powershell 7 and PNP-Powershell Module 1.12 in SharePoint Online. Everything works perfectly. The problem you mentioned did not occur. So I think this problem should have nothing to do with SharePoint and PnP Powershell.
    269902-image.png
    Here is the code I tested:

    Connect-PnPOnline -Url https://mydomain.sharepoint.com/sites/xyzax-version1/  
    # Copy the file to another doclib in the same site  
    Copy-PnPFile -SourceUrl "/sites/xyzax-version1/dlibrary1/Document11.docx" -TargetUrl "/sites/xyzax-version1/dlibrary2/Document11.docx"  
    

    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.