Directory Services |
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: 2.5.5.16.
The following code example shows how to write large integers.
[Visual Basic .NET]
Dim myNumber As System.Int64 = 523442149523.ToUInt64()
Dim l As New LargeInteger()
l.HighPart = Fix(Machine.Shift.Right(myNumber, 32))
l.LowPart = Fix(myNumber And 4294967296.ToUInt32())
usr.Properties("singleLargeInteger").Value = l
usr.CommitChanges()
[C#]
System.Int64 myNumber=523442149523;
LargeInteger l= new LargeInteger();
l.HighPart = (int) (myNumber >> 32);
l.LowPart = (int) (myNumber & 0xFFFFFFFF);
ent.Properties["singleLargeInteger"].Value = l;
ent.CommitChanges();
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 * 4294967296.ToUInt32() + int64Val.LowPart
Console.WriteLine(largeInt)
[C#]
System.Int64 largeInt=0;
IADsLargeInteger int64Val = (IADsLargeInteger) ent.Properties["forceLogoff"].Value;
largeInt = int64Val.HighPart * 4294967296 + int64Val.LowPart;
Console.WriteLine(largeInt);