I have the following bit of code I am using inside an Invoke Code activity:-
Dim FolderInfo As IO.DirectoryInfo = New IO.DirectoryInfo(“\path1\path2\path3”)
Dim FolderAcl As System.Security.AccessControl.DirectorySecurity = FolderInfo.GetAccessControl()
FolderAcl.AddAccessRule(New System.Security.AccessControl.FileSystemAccessRule(“UserName”, System.Security.AccessControl.FileSystemRights.FullControl, System.Security.AccessControl.InheritanceFlags.ContainerInherit Or System.Security.AccessControl.InheritanceFlags.ObjectInherit, System.Security.AccessControl.PropagationFlags.None, System.Security.AccessControl.AccessControlType.Allow))
FolderInfo.SetAccessControl(FolderAcl)
This works with the paramaters passed directly - and in quotes - to the code.
If I try and pass the information into the code as arguments:-
Dim FolderInfo As IO.DirectoryInfo = New IO.DirectoryInfo(varDir)
Dim FolderAcl As System.Security.AccessControl.DirectorySecurity = FolderInfo.GetAccessControl()
FolderAcl.AddAccessRule(New System.Security.AccessControl.FileSystemAccessRule(varUser, System.Security.AccessControl.FileSystemRights.FullControl, System.Security.AccessControl.InheritanceFlags.ContainerInherit Or System.Security.AccessControl.InheritanceFlags.ObjectInherit, System.Security.AccessControl.PropagationFlags.None, System.Security.AccessControl.AccessControlType.Allow))
FolderInfo.SetAccessControl(FolderAcl)
it fails even if I assign the arguments in an assign statement as
varDir - “”“\path1\path2\path3"”"
varUser - “”“UserName”“”
Can anybody assist please