In this post we will focus on the following section of the Management Agent Rules Extension.
In the Synchronization Service click on the MA that you wish to map the Attribute Flows to the above Code.
In this example we were mapping the accountExpires attribute from an object in the Connector Space to an object in the Metaverse converting the value from an integer value to its String equivalent.
Lets take a look at a User Object in Active Directory who has the accountExpires attribute set.
this is what it looks like in the ADUC Gui but if we look at the actual value in ADSI Edit or on the Attribute Editor Tab of the Object in ADUC
so the actual value within AD is 131026644000000000
When syncing this Value with the FIM / MIM Portal which needs this attribute to be converted to its Date Time Format we use this MapAttributesForImport post as an example to achieve this task.
## Additional information on “IMASynchronization.MapAttributesForImport Method” can be located here
void IMASynchronization.MapAttributesForImport( string FlowRuleName, CSEntry csentry, MVEntry mventry)
{
//
// TODO: write your import attribute flow code
//
throw new EntryPointNotImplementedException();
}
In a previous post we detailed 2 Way Account Expires Rules Extension modified to include lastLogonTimestamp and pwdLastSet
The following is copied from that post but is only the section that deals with the Attribute Flow into the Metaverse. this code take the current values that are set for accontExpires and the pwdLastSet attribute on an AD Object and converts to the proper date time string which can be used in the FIM / MIM Portal.
void IMASynchronization.MapAttributesForImport(string FlowRuleName, CSEntry csentry, MVEntry mventry)
{
//
// TODO: write your import attribute flow code
//
switch (FlowRuleName)
{
#region cd.user:accountExpires->mv.person:accountExpires
case “cd.user:accountExpires->mv.person:accountExpires”:
if (csentry[“accountExpires”].IntegerValue == 0 || csentry[“accountExpires”].IntegerValue == 9223372036854775807)
{
// This is a special condition, do not contribute and delete any current value
mventry[“employeeEndDate”].Delete();
}
else
{
DateTime dtFileTime = DateTime.FromFileTime(csentry[“accountExpires”].IntegerValue);
mventry[“employeeEndDate”].Value = dtFileTime.ToString(“yyyy’-‘MM’-‘dd’T’HH':’mm':’ss’.000′”);
}
break;
#endregion
case “cd.user:pwdLastSet->mv.person:pwdLastSet”:
if (csentry[“pwdLastSet”].IsPresent && csentry[“pwdLastSet”].IntegerValue != 0)
mventry[“pwdLastSet”].Value =
ConvertFileTimeToFimTimeStamp(csentry[“pwdLastSet”].IntegerValue);
else
mventry[“pwdLastSet”].Delete();
break;
default:
case “cd.user:lastLogonTimestamp->mv.person:lastLogonTimestamp”:
if (csentry[“lastLogonTimestamp”].IsPresent && csentry[“lastLogonTimestamp”].IntegerValue != 0)
mventry[“lastLogonTimestamp”].Value =
ConvertFileTimeToFimTimeStamp(csentry[“lastLogonTimestamp”].IntegerValue);
else
mventry[“lastLogonTimeStampString”].Delete();
break;
}
}
private static string ConvertFileTimeToFimTimeStamp(long fileTime)
{
return DateTime.FromFileTimeUtc(fileTime).ToString(“yyyy’-‘MM’-‘dd’T’HH':’mm':’ss’.000′”);
}