Closed Rocket101101 closed 5 years ago
Thank you for reporting this issue. We will be triaging your incoming issue as soon as possible.
Following the instructions in https://github.com/SharePoint/PnP/tree/master/Samples/UserProfile.BatchUpdate.API. The issue is gone! Thanks!
Actually this error is still there. I've downloaded the version from GitHub and it still errors on the same line.
Issues that have been closed & had no follow-up activity for at least 7 days are automatically locked. Please refer to our wiki for more details, including how to remediate this action if you feel this was done prematurely or in error: Issue List: Our approach to locked issues
Hello there,
I've tried the PowerShell script as mentioned in the article however cannot get through the following error message -
I believe this is where the error is generated:
$o365 = New-Object Microsoft.Online.SharePoint.TenantManagement.Office365Tenant($Context)
Any comment would be appreciated! Thanks a lot!
The full script is almost same as in the article:
[System.Reflection.Assembly]::LoadFile("C:\Program Files\PackageManagement\NuGet\Packages\Microsoft.SharePointOnline.CSOM.16.1.8810.1200\lib\net45\Microsoft.SharePoint.Client.dll") | Out-Null [System.Reflection.Assembly]::LoadFile("C:\Program Files\PackageManagement\NuGet\Packages\Microsoft.SharePointOnline.CSOM.16.1.8810.1200\lib\net45\Microsoft.SharePoint.Client.Runtime.dll") | Out-Null [System.Reflection.Assembly]::LoadFile("C:\Program Files\PackageManagement\NuGet\Packages\Microsoft.SharePointOnline.CSOM.16.1.8810.1200\lib\net45\Microsoft.Online.SharePoint.Client.Tenant.dll") | Out-Null
# Get needed information from the end user
$adminUrl = "https://kcontoso-admin.sharepoint.com"
#Read-Host -Prompt 'Enter the admin URL of your tenant'
$userName = "admin@contoso.onmicrosoft.com"
#Read-Host -Prompt 'Enter your user name'
$pwd = Read-Host -Prompt 'Enter your password' -AsSecureString
$importFileUrl = Read-Host -Prompt 'Enter the URL to the file located in your tenant'
# Get instances to the Office 365 tenant using CSOM
$uri = New-Object System.Uri -ArgumentList $adminUrl
$context = New-Object Microsoft.SharePoint.Client.ClientContext($uri)
$context.Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($userName,$pwd)
$o365 = New-Object Microsoft.Online.SharePoint.TenantManagement.Office365Tenant($context)
$context.Load($o365)
# Type of user identifier ["Email", "CloudId", "PrincipalName"] in the user profile service
$userIdType=[Microsoft.Online.SharePoint.TenantManagement.ImportProfilePropertiesUserIdType]::Email
# Name of user identifier property in the JSON
$userLookupKey="idName"
# Create property mapping between the source file property name and the Office 365 property name
# Notice that we have here 2 custom properties in UPA called 'City' and 'OfficeCode'
$propertyMap = New-Object -type 'System.Collections.Generic.Dictionary[String,String]'
$propertyMap.Add("City", "City")
$propertyMap.Add("Office", "OfficeCode")
# Call to queue UPA property import
$workItemId = $o365.QueueImportProfileProperties($userIdType, $userLookupKey, $propertyMap, $importFileUrl);
# Execute the CSOM command for queuing the import job
$context.ExecuteQuery();
# Output the unique identifier of the job
Write-Host "Import job created with the following identifier:" $workItemId.Value
Document Details
⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.