SharePoint Online: Bulk User Properties Import
Overview
When we are working with Office 365 in our organization, some time there is requirement to connect on premise AD to get feed and update it.
In this article, we will review how to export data from AD only for specific (custom) attribute and update it in SharePoint user profile.
Requirement
We are working on Office 365 and in user profile we have created some additional custom attribute. By default, Office 365 supports sync only default properties with AD. To sync additional custom properties, we have to write custom sync engine. Microsoft has released API to sync additional attributes
Solution
Microsoft has released Bulk update custom user profile properties for SharePoint Online APIs to direct sync custom attributes from JSON feed file.
To achieve solution, below are the steps
- Create and upload JSON feed file according to business requirement
- Feed output of step 1, to Microsoft Bulk User Import API
- Check the status of an import job
Create and upload a JSON feed file
It’s the important steps that needs to take care, use TechNet Gallery code snippet to generate JSON file for our environment and upload it to we’re a document library on our tenant.
Used UPN as unique key to update user properties. Sample output JSON file is below
{ "value":
[
{
"IDName": "jagga.v@sharepointexcellence.com",
"Company": "SharePoint Excellence",
"StreetAddress": "some value",
"PostalCode": " some value",
"city": " some value",
"Country": "some value"
}
]
}
Execute Microsoft Bulk User Import CSOM API
Microsoft has releases his CSOM API for the same, we can find the Source code CSOM and PowerShell from here. Make sure the we need to update this w.r.t. our business needs.
The source JSON file must be uploaded to the same SharePoint Online tenant where the process is started.
Check the status of an import job
We can check the status of our import job by Microsoft CSOM APIs. There are two methods to validate the status and the same is detailed documented here
Exception Handling
Now we are done with our custom sync engine but the main thing is how to handle exceptions while import job progress? Microsoft CSOM bulk user import APIs is handling it automatically, it used two types of validation process
- Queue the bulk user import script JSON feed file as initial screening
- Log exception if any exception is in between bulk user import for specific user
These log file have placed automatically at the location where our JSON file is exist. For more detailed information on exception handling read detailed documentation here
Limitation
- Maximum file size of JSON file is 2 GB
- Maximum number of properties in JSON file is 500,000
- The import only works for user profile properties that have not been set to be editable by end users
- The import only allows custom properties that are not Active Directory core properties. These must be synchronized to Azure AD
- Taxonomy based custom user properties not supported with this API