How to Programmatically Change File Permissions with Commerce.AdminSecurity (257206)



The information in this article applies to:

  • Microsoft Site Server 3.0 Commerce Edition

This article was previously published under Q257206

SUMMARY

Microsoft Site Server 3.0, Commerce Edition includes the Commerce.AdminSecurity object that can be used to programmatically change file-level permissions for Windows NT accounts or groups.

MORE INFORMATION

The following Visual Basic example code demonstrates how to grant the local Guest group Read permissions to the local C:\Temp directory:
Sub main()
Call SetFolderSecurity("C:\Temp", "Guests")
End Sub

Function SetFolderSecurity(strFoldername, strNTGroupName)
Dim objsecurity As Object
Set objsecurity = CreateObject("Commerce.AdminSecurity")
    objsecurity.AddPermission CStr(strNTGroupName), CLng(&H80000000)
    objsecurity.AddPermission "Administrators", CLng(&H10000000)
    objsecurity.WriteSecurityDirectory strFoldername, True
End Function
				

Microsoft provides programming examples for illustration only, without warranty either expressed or implied. This includes, but is not limited to, the implied warranties of merchantability or fitness for a particular purpose. This article assumes that you are familiar with the programming language that is being demonstrated and with the tools that are used to create and to debug procedures. Microsoft support engineers can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific requirements.

Modification Type:MajorLast Reviewed:6/23/2005
Keywords:kbfix kbhowto KB257206