Convert EmployeeEndDate to AcountExpires by adding 1 year
Hello! Here is the example to add 180 days from user's date provisoning by converting from emploeeenddate to accountexpires. We need to add number of the days (for example 365) to the employyenddate date value. To set accountExpires to expire after 180 days from user´s date provisioning csentry["accountExpires"].Value = DateTime.Now.AddDays(180).ToFileTimeUtc().ToString(); How to add the number of the days to employeeenddate or accountexpiresdate? csentry["accountExpires"].Value = DateTime.Now.AddDays(180).ToFileTimeUtc().ToString(); Thanks
October 3rd, 2011 3:57am

Hi you can use the following code as part of the "MapAttributesForExport(ByVal FlowRuleName" and also add the "Private Function ConvertToFileTimeUtc": *********************** Public Sub MapAttributesForExport(ByVal FlowRuleName As String, ByVal mventry As MVEntry, ByVal csentry As CSEntry) Implements IMASynchronization.MapAttributesForExport Select Case FlowRuleName Case "cd.user:accountExpires<-mv.person:employeeEndDate" If Not mventry("employeeEndDate").IsPresent Then csentry("accountExpires").IntegerValue = 0 Else If mventry("employeeEndDate").IsPresent Then Dim endDateSTR As String = mventry("employeeEndDate").Value Dim endDate As DateTime = DateTime.Parse(endDateSTR) Dim NewendDate As DateTime = endDate.AddDays(1) Dim NewendDateSTR As String = NewendDate.ToString csentry("accountExpires").IntegerValue = ConvertToFileTimeUtc(NewendDateSTR) End If End If Case Else Throw New EntryPointNotImplementedException() End Select End Sub Private Function ConvertToFileTimeUtc(ByVal sourceval As String) As Long Return DateTime .Parse(sourceval).ToFileTimeUtc() End Function ****************************** Regards, Andre
Free Windows Admin Tool Kit Click here and download it now
October 3rd, 2011 5:19am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics