IObjectSecurity Method: SetSecurityOnFile

SetSecurityOnFile
(
 File As String
);

Parameters

[in] String File
Path of the file or directory on which security is to be set.

Description
Stamps the security permissions of the currently attached file or directory on the file or directory specified by the FilePath parameter.

Remarks
This method can be used to replicate security permissions of an attached file on multiple files.

Example

Dim ObjSec As IObjectSecurity
Dim strFilePath1 As String
Dim strFilePath2 As String
strFilePath1 = "d:\source.txt"
strFilePath2 = "d:\destination.txt"
Set ObjSec = CreateObject("DirectScript.ObjectSecurity")
'Read the security from strFilePath1
ObjSec.AttachFile strFilePath1, "MachineName" True
'Set the security of the currently attached file\directory to
'strFilePath2
ObjSec.SetSecurityOnFile strFilePath2

 

See Also