A community member has associated this post with a similar question:
SharePoint Management Shell commands not working

Only moderators can edit this content.

Correct command to export document library is SharePoint Server 2019

Tevon2.0 1,106 Reputation points
2023-01-19T15:53:38.26+00:00

I tried to use this cmd to export a document library from my old site and received the error message below. What is wrong with my command?

 

Export-SPWeb http://lg/emp -itemurl “http://lg-emp/My%20HR/Forms/AllItems.aspx" -path "E:\Emp DL\My H.R" -IncludeVersions All-IncludeUserSecurity

PS C:\Users\sp_farmadmin> Export-SPWeb http://lg-empctr -itemurl "http://lg-empctr/My%20HR/Forms/AllItems.aspx" -path "E:\EmpCtr DL\My H.R" -IncludeVersions All -IncludeUserSecurity
Export-SPWeb : <nativehr>0x80070057</nativehr><nativestack></nativestack>
At line:1 char:1
+ Export-SPWeb http://lg-empctr -itemurl "http://lg-empctr/My%20HR/Form ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidData: (Microsoft.Share...CmdletExportWeb:SPCmdletExportWeb) [Export-SPWeb], ArgumentExce
   ption
    + FullyQualifiedErrorId : Microsoft.SharePoint.PowerShell.SPCmdletExportWeb
Microsoft 365 and Office SharePoint Server For business
Microsoft 365 and Office SharePoint Server Development
0 comments No comments
{count} votes
Accepted answer
  1. RaytheonXie_MSFT 40,471 Reputation points Microsoft External Staff
    2023-01-20T02:55:35.0633333+00:00

    Hi @Tevon2.0

    In your case, the command to export should be like following

    Export-SPWeb -Identity "http://lg/emp" -Path "C:\Backup\Library\Documents.cmp" -ItemUrl "My%20HR" -IncludeUserSecurity -IncludeVersions All -verbose

    And here is the result in my test

    User's image


    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.

    1 person found this answer helpful.
    0 comments No comments

0 additional answers

Sort by: Most helpful