IWMSAccessControlList.Add (C#)

banner art

Previous Next

IWMSAccessControlList.Add (C#)

The Add method adds a new IWMSAccessControlEntry object to the IWMSAccessControlList collection.

Syntax

  IWMSAccessControlEntry = IWMSAccessControlList.Add(bstrTrustee, wmsAccess);

Parameters

bstrTrustee

[in] string containing the name of the account or logon session to which the access control entry applies. The name can identify one of the following account or session types.

Type Description
Domain Account The name specifies a domain account of the form domain\user_account.
NT Security Principal The name identifies an NT-based security system attribute.
Built-in group The name identifies a built-in user group identified by the NT-based security system. It has the form BUILTIN\user_group_name.

wmsAccess

[in] Member of a WMS_ACCESS_CONTROL enumeration type containing the trustee access mask setting. This must be one of the following values.

Value Description
WMS_ACL_DENY_READ Denies read access.
WMS_ACL_DENY_WRITE Denies write access.
WMS_ACL_DENY_CREATE Denies creation access.
WMS_ACL_DENY_ALL Denies read, write, and creation access.
WMS_ACL_ALLOW_READ Enables read access.
WMS_ACL_ALLOW_WRITE Enables write access.
WMS_ACL_ALLOW_CREATE Enables creation access.
WMS_ACL_ALLOW_ALL Enables read, write, and creation access.

Return Values

This method returns an IWMSAccessControlEntry object.

If this method fails, it throws an exception.

Number Description
0x80070057 The wmsAccess value is not valid, or the bstrTrustee name does not contain a backslash (\) or a period (.).
1315 The bstrTrustee parameter does not contain a properly formed account name.
52 A duplicate account name exists on the network.

Example Code

using Microsoft.WindowsMediaServices.Interop;
using System.Runtime.InteropServices;

// Declare variables.
WMSServer Server;
IWMSPlugin Plugin;
IWMSACLCheckAdmin ACLCheckAdmin;
IWMSAccessControlList AccessCtrlList;

try {
    // Create a new WMSServer object.
    Server = new WMSServerClass();

    // Retrieve the plug-in to be configured.
    Plugin = Server.EventHandlers[
        "WMS Publishing Points ACL Authorization"];

    // Retrieve the custom interface of the plug-in.
    ACLCheckAdmin =
               (IWMSACLCheckAdmin)Plugin.CustomInterface;

    // Retrieve the list of access control entries.
    AccessCtrlList = ACLCheckAdmin.AccessControlList;

    // Add a new entry to the access control list.
    AccessCtrlList.Add("DOMAIN\\username", WMS_ACCESS_CONTROL.
                                           WMS_ACL_ALLOW_ALL);
}
catch (COMException comExc) {
    // TODO: Handle COM exceptions.
}
catch (Exception e) {
    // TODO: Handle exceptions.
}

Requirements

Reference: Add a reference to Microsoft.WindowsMediaServices.

Namespace: Microsoft.WindowsMediaServices.Interop.

Assembly: Microsoft.WindowsMediaServices.dll.

Library: WMSServerTypeLib.dll.

Platform: Windows Server 2003 family, Windows Server 2008 family.

See Also

Previous Next