PC Review


Reply
Thread Tools Rate Thread

Checking for File/Directory Permissions

 
 
Nigel
Guest
Posts: n/a
 
      16th Jan 2007
Chip Pearson kindly provided the following code to check read/write access
attributes for files, which works great. How do I check for file and
directory permissions in an NTFS network file system?

In my company network I need to check if the user has full control or at
least modify permission to read/write and delete files and/or directories.
Before my VBA programs try to take specific actions.


' code from C Pearson Jan 2007
Dim Attr As Long
Attr = GetAttr("\\DellLapTop\MainDrive\Temp")
If Attr And vbReadOnly Then
Debug.Print "Folder is read-only"
Else
Debug.Print "Folder is read-write"
End If

--
Cheers
Nigel




 
Reply With Quote
 
 
 
 
NickHK
Guest
Posts: n/a
 
      16th Jan 2007
Nigel,
Short of just creating/modifying/deleting a temp file on the test path and
trapping for permission denied errors, there's the API route.

Maybe these will help:
http://vbnet.mvps.org/code/network/netfileenum.htm
http://vbnet.mvps.org/code/network/netsharecheck.htm

NickHK

"Nigel" <nigel-(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Chip Pearson kindly provided the following code to check read/write access
> attributes for files, which works great. How do I check for file and
> directory permissions in an NTFS network file system?
>
> In my company network I need to check if the user has full control or at
> least modify permission to read/write and delete files and/or directories.
> Before my VBA programs try to take specific actions.
>
>
> ' code from C Pearson Jan 2007
> Dim Attr As Long
> Attr = GetAttr("\\DellLapTop\MainDrive\Temp")
> If Attr And vbReadOnly Then
> Debug.Print "Folder is read-only"
> Else
> Debug.Print "Folder is read-write"
> End If
>
> --
> Cheers
> Nigel
>
>
>
>



 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
checking the file permissions for a word document =?Utf-8?B?b21wNDg4Mw==?= Microsoft Access 0 4th Sep 2007 11:06 PM
Checking if a file exists regardless of the permissions on it sprash Microsoft C# .NET 7 16th Jun 2007 06:51 PM
Need help with checking file permissions. MSDN Account Microsoft C# .NET 1 4th Jan 2005 09:07 PM
Checking File Permissions blue Microsoft ASP .NET 1 15th Jul 2004 02:18 AM
Checking File/Folder Permissions Jeff Microsoft C# .NET 0 24th Sep 2003 05:02 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 04:18 PM.