Large Integer Property Type

To write values to properties that require large integers, use the System.Int64 structure. To read values from properties that use large integers, use COM Interop to access IADsLargeInteger. In ADSI, large integers use the property type ADSTYPE_LARGE_INTEGER.

Note  In the Active Directory Schema, the syntax name used for large integers is called LargeInteger and is represented in the Syntax row of attribute tables with the Syntax ID:

The following code example shows how to write large integers.

[Visual Basic .NET]

Imports System.DirectoryServices
Imports ActiveDs

    Dim ent As New DirectoryEntry("LDAP://CN=My User Name,OU=Marketing,DC=fabrikam,DC=com")
    Dim myNumber As System.Int64 = 523442149523
    Dim LargeInt As New ActiveDs.LargeIntegerClass

    LargeInt.HighPart = CType((myNumber >> 32), Integer)
    myNumber = myNumber << 32
    myNumber = myNumber >> 32

    LargeInt.LowPart = (Convert.ToInt32(myNumber))
    ent.Properties("singleLargeInteger").Value = LargeInt

Catch e As Exception

End Try


System.Int64 myNumber=523442149523;
LargeInteger l= new LargeInteger();
l.HighPart = (int) (myNumber >> 32);
l.LowPart = (int) (myNumber & 0xFFFFFFFF);
ent.Properties["singleLargeInteger"].Value = l;

The following code example shows how to read large integers.

[Visual Basic .NET]

Dim largeInt As System.Int64 = 0
Dim int64Val As IADsLargeInteger = CType(usr.Properties("forceLogoff").Value, IADsLargeInteger)
largeInt = int64Val.HighPart * 0x100000000.ToUInt32() + int64Val.LowPart


System.Int64 largeInt=0;
IADsLargeInteger int64Val = (IADsLargeInteger) ent.Properties["forceLogoff"].Value;
largeInt = int64Val.HighPart * 0x100000000 + int64Val.LowPart;