共享文件夹权限! [英] Shared folder permission!

查看:41
本文介绍了共享文件夹权限!的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用此代码共享文件夹:

I use this code to share folder:

 Public Sub Share()
        Dim managementClass As New ManagementClass("Win32_Share")
        Dim inParams As ManagementBaseObject = managementClass.GetMethodParameters("Create")
        inParams("Description") = "My Description"
        inParams("Name") = "Share Name"
        inParams("Path") = "D:\Folder"
        inParams("Type") = &H0
        Dim outParams As ManagementBaseObject = managementClass.InvokeMethod("Create", inParams, Nothing)
        If Convert.ToUInt32(outParams.Properties("ReturnValue").Value) <> 0 Then MessageBox.Show("Unable to share directory.")
        MessageBox.Show("Shared folder successfully!")
    End 
Sub

现在我想要的是定义可以通过网络访问这个文件夹的用户?我怎么能做到这一点?

Now what I want is to define user that can access to this folder through network? How I can do that?

谢谢!

推荐答案

这篇博文解释了如何设置共享权限:

This blog entry explains how to set up permissions for a share:

http://blogs.msdn.com/helloworld/archive/2008/06/06/programmatically-configuring-permissions-on-a-share-in-c.aspx

代码是用C#编写的,所以移植到VB上没有问题.

The code is in C#, so it not be a problem to port it to VB.

这篇关于共享文件夹权限!的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆