IObjectSecurity Method: AttachFile

 FileorDirectoryPath As String,
 [LookupComputer] As Variant,
 [DontSave] As Variant,
[TakeOwnership] As Variant


[in] String FileorDirectoryPath
Path of the file or directory whose security has to be read. This parameter can be a local path (C:\WINNT) or a UNC path (\\COMPUTERNAME\SHARENAME\FILENAME).

[in] String LookupComputer
This is an optional parameter. This is the computer to be used to look for user and group accounts. If the parameter is not specified, the local computer is assumed by default. This parameter is useful when the accounts do not belong to the current domain or its trusted domains or current computer, but are local to a computer or another domain.

[in] Variant DontSave
This is an optional parameter. This flag indicates whether the operations done on an object should be saved to the disk. If TRUE is specified, the operations will not be committed. By default, changes are saved.

Initializes the ObjectSecurity object with the security of the specified file or directory.


Dim ObjSec As IObjectSecurity
Set ObjSec = CreateObject("DirectScript.ObjectSecurity")
'Attach to d:\test.txt
ObjSec.AttachFile "d:\test.txt"
'Attach to the directory "Test" under the C$ share on the computer \\MOON
ObjSec.AttachFile "\\MOON\C$\Test"


See Also