IAdmPropertyList

The IAdmPropertyList interface extends the IADsPropertyList interface.

Inheritance: IADsPropertyList

Methods

Details

CopyTo()

Copies the contents of this property list to another property list.

void CopyTo(IAdmPropertyList target)

Parameters

  • target – the destination property list to which the contents of this property list will be copied.

GetPropertyItemMask()

Gets the bitmask specified for a property entry. The bitmask specifies which bits of the property value must be changed, and which must be left unchanged.

int GetPropertyItemMask(string propertyName)

Parameters

propertyName – the name of the property for which the bitmask is requested.

Remarks

Bitmasks can be applied to integer properties only.


PutPropertyItemMask()

Sets a bitmask for a property value. The bitmask specifies which bits of the property value must be changed, and which must be left unchanged.

void PutPropertyItemMask(string propertyName, int propertyMask)

Parameters

  • propertyName – the name of the property to which the bitmask will be set.
  • propertyMask – the bitmask to set.

Remarks

Bitmasks can be applied to integer properties only.

  • The property for which you want to set a bitmask must be loaded into the property cache.
  • The control code of the property entry must be set to ADS_PROPERTY_UPDATE.
  • The property entry must contain exactly one property value.

In any of these conditions is not met, the method will throw a COMException.

Examples

The following code samples updates the user's account options in the property list and saves the changes to the directory. Only the Smart card is required flag is updated, preserving the rest of the property value.

PowerShell
[Reflection.Assembly]::LoadWithPartialName("Softerra.Adaxes.Adsi")

# Connect to the Adaxes service.
$ns = New-Object "Softerra.Adaxes.Adsi.AdmNamespace"
$service = $ns.GetServiceDirectly("localhost")

# Bind to object.
$userPath = "Adaxes://CN=John Smith,CN=Users,DC=domain,DC=com"
$user = $service.OpenObject($userPath, $null, $null, 0)
$user.GetInfo()

# Create a property value.
$propertyValue = New-Object "Softerra.Adaxes.Adsi.AdsPropertyValue"
$propertyValue.Integer = 0 # Clear value
$propertyValue.ADsType = "ADSTYPE_INTEGER"

# Create a property entry.
$propertyEntry = New-Object "Softerra.Adaxes.Adsi.AdsPropertyEntry"
$propertyEntry.Name = "userAccountControl"

$propertyEntry.Values =
    @([Softerra.Adaxes.Interop.Adsi.Cache.IADsPropertyValue]$propertyValue)
    
$propertyEntry.ControlCode = "ADS_PROPERTY_UPDATE"
$propertyEntry.ADsType = "ADSTYPE_INTEGER"

# Add the property entry to the property list.
$user.PutPropertyItem($propertyEntry)
$user.PutPropertyItemMask("userAccountControl", 262144) # Only Smart card is required.

# Commit changes to the directory.
$user.SetInfo()
C#
using System;
using Softerra.Adaxes.Adsi;
using Softerra.Adaxes.Interop.Adsi;
using Softerra.Adaxes.Interop.Adsi.Cache;
using Softerra.Adaxes.Interop.Adsi.PersistentObjects;

class Program
{
    static void Main(string[] args)
    {
        // Connect to the Adaxes service.
        AdmNamespace ns = new AdmNamespace();
        IAdmService service = ns.GetServiceDirectly("localhost");

        // Bind to object.
        const string userPath = "Adaxes://CN=John Smith,CN=Users,DC=domain,DC=com";
        IADs user = (IADs)service.OpenObject(userPath, null, null, 0);
        user.GetInfo();

        // Grab the IAdmPropertyList interface.
        IAdmPropertyList propertyList = (IAdmPropertyList)user;

        // Create a property value.
        IADsPropertyValue propertyValue = new AdsPropertyValue();
        propertyValue.Integer = 0; // Clear value
        propertyValue.ADsType = ADSTYPEENUM.ADSTYPE_INTEGER;

        // Create a property entry.
        IADsPropertyEntry propertyEntry = new AdsPropertyEntry();
        propertyEntry.Name = "userAccountControl";
        
        object[] values = { propertyValue };
        propertyEntry.Values = values;

        propertyEntry.ControlCode = ADS_PROPERTY_OPERATION_ENUM.ADS_PROPERTY_UPDATE;
        propertyEntry.ADsType = ADSTYPEENUM.ADSTYPE_INTEGER;

        // Add the property entry to the property list.
        propertyList.PutPropertyItem(propertyEntry);
        propertyList.PutPropertyItemMask("userAccountControl", 262144); // Only Smart card is required

        // Commit changes to the directory.
        user = (IADs)propertyList;
        user.SetInfo();
    }
}

Requirements

Minimum required version: 2009.1

See also