次の方法で共有


Dws.RemoveDwsUser メソッド (websvcDocumentWorkspace)

現在のドキュメント ワークスペース サイトのユーザーの一覧から、指定したユーザーを削除します。

名前空間: websvcDocumentWorkspace
アセンブリ: STSSOAP (stssoap.dll 内)

構文

'宣言
<SoapDocumentMethodAttribute("https://schemas.microsoft.com/sharepoint/soap/dws/RemoveDwsUser", RequestNamespace:="https://schemas.microsoft.com/sharepoint/soap/dws/", ResponseNamespace:="https://schemas.microsoft.com/sharepoint/soap/dws/", Use:=SoapBindingUse.Literal, ParameterStyle:=SoapParameterStyle.Wrapped)> _
Public Function RemoveDwsUser ( _
    id As String _
) As String
'使用
Dim instance As Dws
Dim id As String
Dim returnValue As String

returnValue = instance.RemoveDwsUser(id)
[SoapDocumentMethodAttribute("https://schemas.microsoft.com/sharepoint/soap/dws/RemoveDwsUser", RequestNamespace="https://schemas.microsoft.com/sharepoint/soap/dws/", ResponseNamespace="https://schemas.microsoft.com/sharepoint/soap/dws/", Use=SoapBindingUse.Literal, ParameterStyle=SoapParameterStyle.Wrapped)] 
public string RemoveDwsUser (
    string id
)

パラメータ

  • id
    ユーザーの一覧から削除するユーザーの ID。

戻り値

成功した場合は、空の <Result/> タグを返す文字列。

例外

例外の種類 条件

DwsError.NoAccess (3)

ユーザーは適切な権限を持っていません。

備考

RemoveDwsUser メソッドは、ユーザー ID を指定することにより、現在のドキュメント ワークスペース サイトから、指定したユーザーを削除します。ただし、Document Workspace サービスのメソッドは、ドキュメント ワークスペース サイトのユーザーの ID 値へのアクセスを提供していません。Windows SharePoint Services Users and Groups Web サービスの GetUserInfo メソッドを使用して、ユーザー ID の値を取得してください。

以下のコード例では、Users and Groups Web サービスの GetUserInfo メソッドにユーザーのアカウント名を渡すことによってユーザー ID を取得する方法と、RemoveDwsUser メソッドにユーザー ID を渡すことによって現在のドキュメント ワークスペース サイトからユーザーを削除する方法を示します。この例で使用されているヘルパ関数の全文の詳細については、CanCreateDwsUrl メソッドを参照してください。

Try
    'Get the member's id.
    Dim usrWebService As server.UserGroup = New server.UserGroup()
    Dim xmlUserInfo As System.Xml.XmlNode
    Dim xnrUserInfo As System.Xml.XmlNodeReader
    Dim strUserID As String
    usrWebService.Credentials = myCredentials.DefaultCredentials
    xmlUserInfo = usrWebService.GetUserInfo("DOMAIN\user_name")
    xnrUserInfo = New XmlNodeReader(xmlUserInfo)
    While xnrUserInfo.Read()
        If xnrUserInfo.Name = "User" Then
            strUserID = xnrUserInfo.GetAttribute("ID")
        End If
    End While
    'Remove the member.
    Dim strResult As String
    strResult = dwsWebService.RemoveDwsUser(strUserID)
    If IsDwsErrorResult(strResult) Then
        Dim intErrorID As Integer
        Dim strErrorMsg As String
        Call ParseDwsErrorResult(strResult, intErrorID, strErrorMsg)
        MessageBox.Show _
            ("A document workspace error occurred." & vbCrLf & _
            "Error number: " & intErrorID.ToString & vbCrLf & _
            "Error description:" & strErrorMsg, _
            "DWS Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
    Else
        MessageBox.Show("The user was successfully removed.", _
            "Remove Dws User", MessageBoxButtons.OK, _
            MessageBoxIcon.Information)
    End If
Catch exc As Exception
    MessageBox.Show("An exception occurred." & vbCrLf & _
        "Description: " & exc.Message, _
        "Exception", MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
try
{
    //Get the member's ID.
    server.UserGroup usrWebService = new server.UserGroup();
    System.Xml.XmlNode xmlUserInfo;
    System.Xml.XmlNodeReader xnrUserInfo;
    string strUserID = "";
    usrWebService.Credentials = 
            System.Net.CredentialCache.DefaultCredentials;
        xmlUserInfo = usrWebService.GetUserInfo("DOMAIN\user_name");
    xnrUserInfo = new System.Xml.XmlNodeReader(xmlUserInfo);
    while (xnrUserInfo.Read())
    {
        if (xnrUserInfo.Name == "User")
        {
            strUserID = xnrUserInfo.GetAttribute("ID");
        }
    }
    //Remove the member.
    string strResult = "";
    strResult = dwsWebService.RemoveDwsUser(strUserID);
    if (IsDwsErrorResult(strResult))
    {
        int intErrorID  = 0;
        string strErrorMsg = "";
        ParseDwsErrorResult(strResult, out intErrorID, 
            out strErrorMsg);
        MessageBox.Show
            ("A document workspace error occurred.\r\n" +
            "Error number: " + intErrorID.ToString() + "\r\n" +
            "Error description: " + strErrorMsg,
            "DWS Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
    }
    else
    {
        MessageBox.Show
            ("The user was successfully removed.",
            "Remove Dws User", MessageBoxButtons.OK,
            MessageBoxIcon.Information);
    }
}
catch (Exception exc)
{
    MessageBox.Show("An exception occurred.\r\n" +
        "Description: " + exc.Message,
        "Exception", MessageBoxButtons.OK, MessageBoxIcon.Error);
}

関連項目

参照

Dws クラス
Dws メンバ
websvcDocumentWorkspace 名前空間