Share via


IWMSAccessControlList.Add (Visual Basic .NET)

banner art

Previous Next

IWMSAccessControlList.Add (Visual Basic .NET)

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 a 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.

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

Imports Microsoft.WindowsMediaServices.Interop
Imports System.Runtime.InteropServices

Private Sub AddACLEntry()

    ' Declare variables.
    Dim Server As WMSServer
    Dim Plugin As IWMSPlugin
    Dim ACLCheckAdmin As IWMSACLCheckAdmin
    Dim AccessCtrlList As IWMSAccessControlList
    Dim AccessCtrlEntry As IWMSAccessControlEntry

Try
    ' Create the WMSServer object.
    Server = New WMSServer()

    ' Retrieve the plug-in to be configured.
    Plugin = Server.EventHandlers.Item( _
         "WMS Publishing Points ACL Authorization")

    ' Retrieve the custom interface of the plug-in.
    ACLCheckAdmin = Plugin.CustomInterface

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

    ' Add a new entry to the access control list.
    AccessCtrlEntry = AccessCtrlList.Add( _
         "DOMAIN\username", WMS_ACCESS_CONTROL.WMS_ACL_ALLOW_ALL)

Catch excCom As COMException
    ' TODO: Handle COM exceptions.
Catch exc As Exception
    ' TODO: Handle errors.
Finally
    ' TODO: Clean-up code goes here.
End Try

End Sub

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