How to update the Manager Attribute in Active Directory using the Data Sync V1 Connector

As this process can be complicated we have built in this functionality directly into our latest Active Directory connector. Read more on this here.

The following article will explain the options you have to return the distinguished name of the manager in order to assign managers to users within your Active Directory.

Connect to Active Directory

Connect the Source and target to AD by using the Active Directory Users provider.

Connect to Active Directory

Convert the Manager Attribute to the RAW value

By default we parse out the Manager field so that it's more suitable for input to other systems e.g.SharePoint.
However you can switch off this parsing to get to the raw AD attribute value.

To update the manager you need to supply the full Distinguished name value of the AD Object you want to set which would be something like this below.

CN=Sean Cleaver,CN=Users,DC=xxx,DC=xxx,DC=com

By default TryParseValue and ReadOnly are set to True in the Manager field in the property collection. We need to set both of these to False in order to update the manager attribute in Active Directory.

You can do this by going to the connection properties window and then selecting Properties. Click onto the ellipsis (...) to open the properties collection manager.


Then find the manager attribute in the list and change the values.

Manager Properties

Once you are done, please refresh your target data source by using the refresh button.

Refresh Data Source

If you preview the data you will now notice that the distinguished name of the manager is returned as: CN=User,OU=Test,DC=demo,DC=simego,DC=com. This is how we need to present the manager record in Data Sync to update Active Directory.

Use a Calculated Column to return the Distinguished Name of the manager

Alternatively we can return the distinguished name by using a lookup to Active Directory in a calculated column.

An example of a lookup function to find the Distinguished Name of the manager is:

LOOKUPB("Distinguished Name", "", WHEN("EmployeeID", ReportsTo))

This function looks up the distinguished name when the EmployeeID attribute matches the value in the ReportsTo (manager) column of the source data.

Manager Lookup

You can find more details on Lookups in Active Directory here, such as looking up managers in different OUs.

You then need to map this result to the Manager record in the schema map.

Schema Map

Use Dynamic Columns to return the Manager

Below you will find the sample code we have used to create a Dynamic Column to return the Distinguished Name of the Manager to set against the AD Users. Alternatively, you could use any attributes returned from the AD fields to set the manager's name, you just need to edit the code.

Dynamic Columns

class DataSourceRowOverride : Simego.DataSync.DynamicColumns.DataSourceRowInternal
	public string X_Manager { get; set;}

	public override bool BeginRow()
		X_Manager = "CN=Sean Cleaver, CN=Users, DC=xxx, DC=xxx, DC=com";
		return true;

Map the source column to the Manager attribute

We now need to add our manager column to the schema map (either from your source, calculated column or dynamic column), and map this to the manager attribute from Active Directory.

Make sure to add and select a key column to identify each user, for example Employee ID.

Schema Map

Compare the Data and Synchronise

Now run the compare by clicking Compare A > B and preview the results to make sure the data returns as you intended. Once you are happy with the results click Synchronise to update the manager attribute in Active directory.