Hello,
I am trying to migrate documents from a file share to SharePoint Online using the Migration API. I want to update the Modified By value on a document with a user in SPO, however, I am having issues setting the value to
a new user. The user does exist in SharePoint Online.
Here is what I am doing:
Running the following PowerShell command:
# Create new package from file share
New-SPOMigrationPackage -SourceFilesPath $sourceFiles -OutputPackagePath $sourcePackage -TargetWebUrl $targetWeb -TargetDocumentLibraryPath $targetDocLib -NoAzureADLookup
When that is run, the following xml files are created:
UserGroups.xml
Manifest.xml
In the UserGroups.xml, I get the following:
<?xml version="1.0" encoding="UTF-8"?>
<UserGroupMap xmlns="urn:deployment-usergroupmap-schema">
<Users>
<User Flags="0" IsDeleted="false" SystemId="AQIAAAAAAAUgAAAAIAIAAA==" IsSiteAdmin="false" IsDomainGroup="true" Email="" Login="BUILTIN\Administrators"
Name="" Id="1"/>
</Users>
<Groups/>
</UserGroupMap>
Notice the Id value = 1
In the manifest.xml, I get the following (just including a snippet):
<SPObject Url="/Accounting/test.doc" ParentWebUrl="/Accounting" ParentWebId="84ec82c5-4227-4579-ad19-bd8ca24873f4" ParentId="10394067-6044-46ad-b1c9-250f5a150359"
ObjectType="SPFile" Id="6ad11bcf-45bb-4774-b8b9-f1ebc2b5872f">
<File Url="University/test.doc" ParentWebUrl="/Accounting" ParentWebId="84ec82c5-4227-4579-ad19-bd8ca24873f4" ParentId="10394067-6044-46ad-b1c9-250f5a150359" Id="6ad11bcf-45bb-4774-b8b9-f1ebc2b5872f"
TimeLastModified="2014-11-03T22:38:56" TimeCreated="2016-11-21T22:39:21" Name="test.doc"ModifiedBy="1" Author="1" FileSize="49152" FileValue="test.doc" Version="1.0" ListId="e57e4293-e372-434e-a75b-85337c0bd15d" ListItemIntId="4"/>
</SPObject>
<SPObject Url="/Accounting/test.doc" ParentWebUrl="/Accounting" ParentWebId="84ec82c5-4227-4579-ad19-bd8ca24873f4" ParentId="e57e4293-e372-434e-a75b-85337c0bd15d"
ObjectType="SPListItem" Id="fb35fc12-17ba-4faa-a4ce-14559fd2c7d1">
test.doc">
<Fields/>
</ListItem>
</SPObject>
Notice that the ModifiedBy="1" and Author="1" values are set to 1 …. Which I’m assuming maps to the id of the user in the UserGroups.xml
Anyway, if I were to change the UserGroups.xml file to the following:
<?xml version="1.0" encoding="utf-8"?>
<UserGroupMap xmlns="urn:deployment-usergroupmap-schema">
<Users>
<User Id="1" Name="Fred Flintstone" Login="fred@bedrock.onmicrosoft.com" Email=" fred@bedrock.onmicrosoft.com " IsDomainGroup="false" IsSiteAdmin="false"
SystemId="AQIAAAAAAAUgAAAAIAIAAA==" IsDeleted="false" Flags="0" />
<User Id="2" Name="Barney Rubble" Login="barnie@bedrock.onmicrosoft.com" Email=" barnie@bedrock.onmicrosoft.com " IsDomainGroup="false" IsSiteAdmin="true"
SystemId="AQIAAAAAAAUgAAAAIAIAAA==" IsDeleted="false" Flags="0" />
</Users>
<Groups />
</UserGroupMap>
And then modify the manifest xml to be ModifiedBy="2" Author="2",
I then run the following PowerShell commands:
# Convert package to a targeted one by looking up data in target site collection
ConvertTo-SPOMigrationTargetedPackage -SourceFilesPath $sourceFiles -SourcePackagePath $sourcePackage -OutputPackagePath $targetPackage -TargetWebUrl $targetWeb -TargetDocumentLibraryPath $targetDocLib -Credentials
$Credential
- Submit Package to Azure:
$azurePkg = Set-SPOMigrationPackageAzureSource -SourceFilesPath $sourceFiles -SourcePackagePath $targetPackage -AzureQueueName $azureQueueName -AccountName $azureAccountName -AccountKey $azureAccountKey
Submit-SPOMigrationJob -TargetWebUrl $targetWeb -MigrationPackageAzureLocations $azurePkg -Credentials $Credential
.
Once the files are uploaded to Azure and then migrated to SharePoint Online, all the documents show up as being modified by Fred (User Id=1), instead of Barnie.
In the ConvertMigrationPackage logs, I find the following:
12/15/2016 11:10:58 PM Warning User node fred@patrickcompany.onmicrosoft.com was not sucessfully looked up, marking as deleted
12/15/2016 11:10:58 PM Warning User node barnie@patrickcompany.onmicrosoft.com was not sucessfully looked up, marking as deleted
Any ideas on what I am doing wrong. Basically, I want to update the modified by with various users in SPO. Any help would be greatly appreciated.