Active Directory 'lastLogon' time conversion


i'm lost conversion active directory integer8 datetime format visual c# 2008...
i've found examples on internet, i can't find suitable reference... 
i've included iadstools , activeds... maybe i'm missing right namespace?
using system; using system.data; using system.directoryservices;  using microsoft.sqlserver.dts.pipeline.wrapper; using microsoft.sqlserver.dts.runtime.wrapper;  ...                                                                       if (result.properties["lastlogon"] != null && result.properties["lastlogon"].count > 0)                     {                         long int64value = (long)((uint)result.properties["lastlogon"].lowpart +                         (((long)result.properties["lastlogon"].highpart) << 32));                         output0buffer.lastlogon = datetime.fromfiletimeutc(int64value);                                        } ...                        
error 1 'system.directoryservices.resultpropertyvaluecollection' not contain definition 'lowpart' , no extension method 'lowpart' accepting first argument of type 'system.directoryservices.resultpropertyvaluecollection' found (are missing using directive or assembly reference?)
error 2 'system.directoryservices.resultpropertyvaluecollection' not contain definition 'highpart' , no extension method 'highpart' accepting first argument of type 'system.directoryservices.resultpropertyvaluecollection' found (are missing using directive or assembly reference?)
thanks inputs!


hi murugan , cooldadtx

sorry late reply... somehow lost trace of topic... 

unfortunately input didn't work... because use bi dev studio couldn't use newest visualstudio .net framework 4 seems neccessary use int64 reference... 

i have had create new com component ore something, have lead further problems on deploying project on reporting server... 

so made workaround... imported values string...

  ... if (result.properties["lastlogon"] != null && result.properties["lastlogon"].count > 0)                     {                         output0buffer.lastlogon = result.properties["lastlogon"][0].tostring(); ...  


... , converted them afterwards via bigint and datetime2 on sql server following code:

 

  update ... [lastlogon] = case 	when cast([lastlogon] as bigint) = 0 then null 		else convert(varchar(19),(dateadd(mi,(cast([lastlogon] as bigint) / 600000000) + datediff(minute,getutcdate(),getdate()),cast('1/1/1601' as datetime2))), 120) end, ...  


that's it... anyways, appreciated help...

 

 



Visual Studio Languages  ,  .NET Framework  >  Visual C#



Comments

Popular posts from this blog

Azure DocumentDB Owner resource does not exist

BizTalk Server 2013 Azure VM Log Shipping and HA for hosts

How to Share webservice object to all user