Jesse
Jesse

Reputation:

File Permissions Dialog via .NET

How can I launch the standard file permissions dialog from a .NET application? Can't seem to find any example of this anywhere. I don't want to programmatically set file permissions, I want to let a user set them via the dialog.

Upvotes: 0

Views: 384

Answers (4)

Jesse
Jesse

Reputation:

And another easier method:

BOOL SHObjectProperties( HWND hwndOwner, DWORD dwType, LPCWSTR szObject, LPCWSTR szPage );

Upvotes: 0

Daniel Earwicker
Daniel Earwicker

Reputation: 116674

The Shell API (IShellFolder) might be a way to do this, if you can find out which verb will open the security dialog for a file. I just tried writing a script to list the verbs available on a file, and the closest thing I could see was "Properties" which would show all the property pages, not just security. Also when I tried to invoke the verb, nothing happened. So not much of an answer, I admit, but maybe it will be a starting point.

Upvotes: 0

Tim Jarvis
Tim Jarvis

Reputation: 18815

I don't think that there is a wrapper in Winforms that wraps that dialog, it would be simple enough to create your own dialog though, you need to call the SetAccessControl method from the FileInfo class, there is an example here

http://msdn.microsoft.com/en-us/library/system.io.fileinfo.setaccesscontrol.aspx

Upvotes: 1

Related Questions