How to read folder security

  • Thread starter Thread starter Phil Haddock
  • Start date Start date
P

Phil Haddock

Can anyone post a code snippet on how to retrieve Permission information on
a Folder? (Visual Basic 2005)

There's lot's of information on how to set a permission, but I can't figure
out how to read them. I want to be able to return what Users and Groups
have what permissions on the folder. I'm not interested in the files
within, although I know that they may vary from the folder itself.

Thanks,

Phil Haddock
 
It is a bit mask:


FileAttributes attributes = Directory.Attributes;

//examples (C#)
//For VB.NET use And for the logical AND

bool isArchive = ((attributes & FileAttributes.Archive) ==
FileAttributes.Archive);
bool isCompressed = ((attributes & FileAttributes.Compressed) ==
FileAttributes.Compressed);
bool isEncrypted = ((attributes & FileAttributes.Encrypted) ==
FileAttributes.Encrypted);
bool isHidden = ((attributes & FileAttributes.Hidden) ==
FileAttributes.Hidden);
bool isNormal = ((attributes & FileAttributes.Normal) ==
FileAttributes.Normal);
bool isReadOnly = ((attributes & FileAttributes.ReadOnly) ==
FileAttributes.ReadOnly);

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

***************************
Think Outside the Box!
***************************
 
Back
Top