SOLVED

Map author/editor to users in Migration import API

New Contributor

Hi, I got some issues recently to map author/editor of a document to users by using Migration API.

 

I got it work a few days ago, but it stopped working so I am wondering if there are changes from infrastructure.

 

Here is what I have:

1. In UserGroup.xml, I have a <User>: 

 

<User Id="0" Name="" Login="i:0#.f|membership|email address removed for privacy reasons" Email="" SystemId="" IsDomainGroup="false" IsDeleted="false" />

 

 Correct me if I am wrong, I found that when I put correct Login, it should connect to the user.

2. In Manifest.xml, Author and ModifiedBy are filled with "0" which is matching the id in usergroup.xml.

 

<SPObject ObjectType="SPFile" Id="95bbbff7-3ca9-4d73-84bb-00c0698f50fc" ...>
    <File Name="Sample.txt" Id="95bbbff7-3ca9-4d73-84bb-00c0698f50fc" Url="Shared Documents/Sample.txt" Author="0" ModifiedBy="0" MD5Hash="ZnktZ9e8Dpwps4dA27mAlw==" ...>
      <Versions>
        <File Name="Sample.txt" Id="95bbbff7-3ca9-4d73-84bb-00c0698f50fc" Url="Shared Documents/Sample.txt" Author="0" ModifiedBy="0" MD5Hash="ZnktZ9e8Dpwps4dA27mAlw==" ...>
        </File>
      </Versions>
    </File>
  </SPObject>
  <SPObject ObjectType="SPListItem" ...>
    <ListItem Name="Sample.txt" DirName="/sites/DestinationSite/Shared Documents" FileUrl="/Shared Documents/Sample.txt" Author="0" ModifiedBy="0" ...>
      <Fields />
      <Versions>
        <ListItem Name="Sample.txt" ...>
          <Fields />
        </ListItem>
      </Versions>
    </ListItem>
  </SPObject>

 

 

Here is the full log if it helps:

 

[7/6/2022 1:30:03 PM] Start Time: 7/6/2022 1:30:03 PM.
[7/6/2022 1:30:03 PM] Correlation Id: 15764ea0-80b6-2000-1256-d7ced5f2788e 
[7/6/2022 1:30:03 PM] [Progress] Initializing Import.
[7/6/2022 1:30:03 PM] [Progress] Downloaded SystemData.xml: SnapShotTime == ; MD5 == gVVKJlBTDyXvaEyPSRaIlA==; Size == 345 bytes
[7/6/2022 1:30:03 PM] [Progress] Downloaded Requirements.xml: SnapShotTime == ; MD5 == ocg3J/9WE1fAURRfIiAesw==; Size == 99 bytes
[7/6/2022 1:30:03 PM] [Progress] Downloaded ExportSettings.xml: SnapShotTime == ; MD5 == Gq/OcMdb9mx7se2T1oLhhA==; Size == 202 bytes
[7/6/2022 1:30:03 PM] [Progress] Downloaded SystemData.xml: SnapShotTime == ; MD5 == gVVKJlBTDyXvaEyPSRaIlA==; Size == 345 bytes
[7/6/2022 1:30:03 PM] [Progress] Downloaded UserGroup.xml: SnapShotTime == ; MD5 == AfSUSDCVOsP7tGsaWw8T/g==; Size == 272 bytes
[7/6/2022 1:30:03 PM] [Progress] Importing User i:0#.f|membership|email address removed for privacy reasons.
[7/6/2022 1:30:03 PM] [Warning] [-2130575276] [Microsoft.SharePoint.SPException] [The user does not exist or is not unique.] 
[7/6/2022 1:30:03 PM] [Debug]    at Microsoft.SharePoint.SPGlobal.HandleComException(COMException comEx)
   at Microsoft.SharePoint.Library.SPRequest.EnsureUserExists(String bstrUrl, String bstrLogin, Guid& pGuidObjectId, Guid& pGuidHomeTenantId, String bstrEmail, String bstrName, String bstrNotes, String bstrMobilePhone, Int32 lFlags, Boolean bIsRole, Boolean bSendEmail, Boolean bForceAdd, Byte[]& ppsaSystemId, Boolean bImportDeleted, Int32& plUserId)
   at Microsoft.SharePoint.Deployment.ImportObjectManager.EnsureUser(Byte[] sid, String login, Nullable`1 objectId, Nullable`1 homeTenantId, Boolean isRole, String display, String email, String notes, String mobilePhone, Int32 flags, Boolean deleted, Int32 idOld, Int32& idNew, Boolean forceImport)
[7/6/2022 1:30:03 PM] [Warning] Failed to ensure user 'i:0#.f|membership|email address removed for privacy reasons'
[7/6/2022 1:30:03 PM] [Progress] Downloaded LookupListMap.xml: SnapShotTime == ; MD5 == Se65rWU6BXFm+HZjy4Xx0w==; Size == 491 bytes
[7/6/2022 1:30:03 PM] [Progress] Starting content import.
[7/6/2022 1:30:03 PM] [Progress] De-Serializing Objects to Database.
[7/6/2022 1:30:03 PM] [Progress] Downloaded Manifest.xml: SnapShotTime == ; MD5 == TIoEH7+Ec6dRHDoMuBTqrg==; Size == 5634 bytes
[7/6/2022 1:30:03 PM] [Folder] [Shared Documents] [fe572166-13c1-47a4-a7b9-260ca5d017df][Progress] Importing
[7/6/2022 1:30:03 PM] [Folder] [Shared Documents] [fe572166-13c1-47a4-a7b9-260ca5d017df]  [Verbose] Source URL: Shared Documents
[7/6/2022 1:30:03 PM] [Folder] [0706] [b49d7221-b555-4bf5-ab38-80ae2c639505][Progress] Importing
[7/6/2022 1:30:03 PM] [Folder] [0706] [b49d7221-b555-4bf5-ab38-80ae2c639505]  [Verbose] Source URL: Shared Documents/0706
[7/6/2022 1:30:03 PM] [Folder] [0706] [b49d7221-b555-4bf5-ab38-80ae2c639505]  [ExtendedVerbose] No folder with id b49d7221-b555-4bf5-ab38-80ae2c639505 was found in the site collection with id 2d6d7c94-b9d4-435c-a816-029c1087c314
[7/6/2022 1:30:03 PM] [Folder] [0706] [b49d7221-b555-4bf5-ab38-80ae2c639505]  [ExtendedVerbose] Creating
[7/6/2022 1:30:03 PM] [List] [Documents] [7b911605-170f-4a94-a845-44e331fc7d9a][Progress] Importing
[7/6/2022 1:30:03 PM] [ListItem] [Sample.txt] [95bbbff7-3ca9-4d73-84bb-00c0698f50fc][Progress] Importing
[7/6/2022 1:30:03 PM] [ListItem] [Sample.txt] [95bbbff7-3ca9-4d73-84bb-00c0698f50fc][Progress] Importing
[7/6/2022 1:30:03 PM] [ListItem] [Sample.txt] [95bbbff7-3ca9-4d73-84bb-00c0698f50fc]  [Verbose] List URL: /sites/Destiantion/Shared Documents
[7/6/2022 1:30:03 PM] [ListItem] [Sample.txt] [95bbbff7-3ca9-4d73-84bb-00c0698f50fc]  Importing File Version 12.0
[7/6/2022 1:30:03 PM] [ListItem] [Sample.txt] [95bbbff7-3ca9-4d73-84bb-00c0698f50fc]  [Verbose] Deleting...
[7/6/2022 1:30:03 PM] [ListItem] [Sample.txt] [95bbbff7-3ca9-4d73-84bb-00c0698f50fc]  [Progress] 42_12.0: SnapShotTime == ; MD5 == ZnktZ9e8Dpwps4dA27mAlw==; Size == 23967 bytes
[7/6/2022 1:30:04 PM] [Verbose] Performing final fixups.
[7/6/2022 1:30:04 PM] [Progress] Import completed.
[7/6/2022 1:30:04 PM] Finish Time: 7/6/2022 1:30:04 PM.
[7/6/2022 1:30:04 PM] Duration: 00:00:00
[7/6/2022 1:30:04 PM] Byte imported: 23,967.00 at 25,145.47 bytes per second
[7/6/2022 1:30:04 PM] Total Processed Objects: 5
[7/6/2022 1:30:04 PM] Finished with 2 warnings.
[7/6/2022 1:30:04 PM] Finished with 0 errors.

 

 

I also used migration export API to generate UserGroup.xml and used <User> from it but still no luck.

 

Any help will be appreciated! Thanks in advance.

1 Reply
best response confirmed by dongyangli (New Contributor)
Solution
Deleting the discussion, turned out i was missing author/modifiedby in sub-listitem.