Large Integer Property Type

Active Directory Domain Services schema properties such as lastLogon use the LargeInteger syntax type. For more information about the lastLogon property or the LargeInteger syntax type, see lastLogon or LargeInteger in the MSDN Library at https://go.microsoft.com/fwlink/?LinkID=27252.

If a property of this type is obtained with the Properties property, this data type is represented as a COM object that can be cast to an IADsLargeInteger. For more information about the IADsLargeInteger type, see IADsLargeInteger in the MSDN Library at https://go.microsoft.com/fwlink/?LinkID=27252.

If a property of this type is obtained from a ResultPropertyValueCollection, this data type is represented as an Int64 structure.

The following example shows how to convert from the IADsLargeInteger type to the DateTime type.

public static DateTime GetDateTimeFromLargeInteger(IADsLargeInteger largeIntValue)
{
    //
    // Convert large integer to int64 value
    //
    long int64Value = (long)((uint)largeIntValue.LowPart +
             (((long)largeIntValue.HighPart) << 32 ));  

    //
    // Return the DateTime in utc
    //
    return DateTime.FromFileTimeUtc(int64Value);
}

The following example shows how to convert from DateTime format to IADsLargeInteger.

public static IADsLargeInteger GetLargeIntegerFromDateTime(DateTime dateTimeValue)
{
    //
    // Convert DateTime value to utc file time
    //
    Int64 int64Value = dateTimeValue.ToFileTimeUtc();

    //
    // convert to large integer
    //
    IADsLargeInteger largeIntValue = 
         IADsLargeInteger) new LargeInteger();
    largeIntValue.HighPart = (int) (int64Value >> 32);
    largeIntValue.LowPart = (int) (int64Value & 0xFFFFFFFF);

    return largeIntValue;
}

See Also

Reference

System.DirectoryServices
DirectoryEntry
ResultPropertyValueCollection

Concepts

Property Types

Send comments about this topic to Microsoft.

Copyright © 2007 by Microsoft Corporation. All rights reserved.