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, I’m explaining a case; 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
- 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 your environment and upload it to you’re a document library on your 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, you can find the Source code CSOM and PowerShell from here. Make sure the you need to update this w.r.t. your 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
You can check the status of your import job by MS CSOM APIs. There are two methods to validate the status and the same is detailed documented here
Exception Handling
Now you are done with your 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
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

Comments
Post a Comment