473,396 Members | 1,860 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

How to read folder security

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
Mar 27 '06 #1
1 1741
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!
***************************
"Phil Haddock" wrote:
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

Mar 28 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: SPM2 | last post by:
I have a database on one computer, and have the folder shared out. And I a have another computer linked to this database. But the problem I am having is that the 2nd computer when opening the...
4
by: Miro | last post by:
Hello! I have an ASP.NET application which needs to read some data from an Access database on Novell. I've found an article on Microsoft and did the following: I've created an account on...
3
by: Dave Coate | last post by:
Hello again, I am going to re-post a question. I got some excellent suggestions from Rob and Mattias on this but their ideas did not solve the problem. Here is the original post: ...
5
by: Mitchell S. Honnert | last post by:
Is there a way, given the full path of a folder on a network, that one can programatically tell if you have Read access to that folder? I have an application where the user is able to select a...
2
by: keithb | last post by:
This is on a remote server. Everything works in the development envirmonment. Any ideas? Thanks, Keith Failed to update database "C:\BTM_ROOT\APP_DATA\ASPNETDB.MDF" because the database is...
3
by: jao.sanien | last post by:
Hi I have a access file that need to be made to read only. And the file should be password protected if I want to edit something. So those who doesn't have the password can only read. I don't...
3
by: James Maeding | last post by:
I am familiar with using My.Computer.FileSystem.GetDirectoryInfo to get folder attributes, see code below... This does not work though for network drives on my companies system. We use windows as...
2
by: Bill Fallon | last post by:
I have a VS2005 VB.Net windows form application deployed to a share drive. The windows explorer security permissions for this application (.exe) file is set for Everyone with List Folder/Read Data...
8
by: paquer | last post by:
Database Users need to have Read/Write etc... permissions to the folder where the Database resides in order to create the lock file. I have read only users. I have set up the Shortcut that links...
4
by: Jim | last post by:
I have the following piece of code: Directory.CreateDirectory(myDir); DirectoryInfo lDir = new DirectoryInfo(myDir); lDir.Attributes = FileAttributes.Normal; When this code runs, my directory...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.