Could not post the contents here as it is too long for the post size limit, so I've attached the 2 vb files to this post.
See "Attached Files" section at the bottom of this post for my classes that make use of the NetShareAdd Windows API (and a couple of others) - just add them both to your project and then you can use my simple .NET wrapper as shown in the previous postOf course you can also just use them to see how the APIs are defined and used etc and make your own .NET versions.
EDIT: New version of SharedFolder class uploaded that now allows you to create a share on a remote machine. There is now an optional argument for the SharedFolder.ShareExistingFolder method where you can specify the remote machine name - do not use "\\ServerName", just "ServerName" will do it.
If you want to create the share locally then just either miss this argument off or specify Nothing for it.
Here is an example of sharing the folder D:\Shared as "Shared Folder" on a remote server called TestServer:
vb Code:
SharedFolder.ShareExistingFolder("Shared Folder", "This is an example comment", "D:\Shared", PermissionsList, "TestServer")
Note that I have included this functionality (along with a load of other Windows API based functions) in my Windows API library, which you can download for free here: http://cjwdev.wordpress.com/2010/07/...pack-released/




Of course you can also just use them to see how the APIs are defined and used etc and make your own .NET versions.
Reply With Quote