IObjectSecurity Method: SetAccessPermissions

 Trustee As String,
 AccessPermissions As String


[in] String Trustee
User or group name for whom permissions are to be set.

[in] String AccessPermissions
Access permissions to be set. See Access Permissions for a complete list of access permissions that can be set for a securable object.

Specifying a NULL or empty string for this parameter removes all direct access that the Trustee currently has on the object. The string could be either "VbNull" or "vbEmptyString".

Sets (gives) access permissions to a user or group. This functions differs from GrantAccessPermissions. SetAccessPermissions removes existing permissions that the Trustee might have. SetAccessPermissions also accepts deny access permissions like -F, -W, and so on.


Dim ObjSec  As IObjectSecurity
Set ObjSec = CreateObject("DirectScript.ObjectSecurity")
'Attach to the file c:\winnt\logon.exe
ObjSec.AttachFile "c:\winnt\logon.exe"
'Give the user John X(Execute) permissions on the attached file logon.exe
ObjSec.SetAccessPermissions "MSFT\John", "X"


See Also