Get network folder attributes
I've been trying to no avail to determine network folder read/write attributes, such as "Read-Only". I've tried GetAttr(), but it does not show the correct permissions on our network, even though looking at the folders properties page, it does show all the set attributes under the Security tab.
The only thing that works, is to attempt to create a temporary file into a particular folder, with On Error trapping (yes I know this is a really bad way to do this).
If Explorer can see this, I would assume it would be some API call (2K/XP), but I've yet to find something that works.
# 1 Re: Get network folder attributes
Welcome to the forums. Google is your friend, and ALLAPI is the place to find API's. http://allapi.mentalis.org/apilist/DAD43CF20ED09D1897B0ECAAF0BF86EE.html
# 2 Re: Get network folder attributes
Thanks dglienna, AllAPI.net (http://allapi.mentalis.org/) was a great place to start. Lots of API info.
I pared down GetFileAttributes() down to the bare minimum as follows:
Private Declare Function GetFileAttributes Lib "kernel32" _
Alias "GetFileAttributesA" _
(ByVal lpFileName As String) As Long
FileAttr = GetFileAttributes(PathFile)
Still, while providing more info, I'm still not seeing the correct folder attributes on our network. It's my understanding that we use group policy's to set permissions (I'm not a network guru, so I know very little about these). As I mentioned, I would have to assume that if Explorer can see this info, it can be seen in VB.
The way our network is setup, there are generally 5 names assigned to the security policy (two Admins and SYSTEM with Full Control, a Doc Control user with all but Full Control, and "Everyone" with "Read & Execute", "List Folder Contents", and "Read" permissions.) This is probably similar to most other network permission scenarios.
This is the present dilemma I'm faced with - not knowing what the permissions are until I perform a function then when trying to save the file, I'm rudely informed that the destination's folder is read-only.
Any help would be greatly appreciated.
# 3 Re: Get network folder attributes
Ahh. Totally different. You don't need api's.
http://www.microsoft.com/technet/scriptcenter/tools/admatic.mspx
is a tool that will write scripts for you!