次の方法で共有


Dws.CreateDws メソッド (websvcDocumentWorkspace)

ドキュメント ワークスペース サイトを作成し、必要に応じて新しい SharePoint サイトにユーザーを追加します。

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

構文

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

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

パラメータ

  • name
    String。新しいドキュメント ワークスペース サイトの URL (オプション)。空の文字列が渡された場合、新しい SharePoint サイトの URL は title に基づいて決定されます。このとき、無効な文字は削除されるかアンダースコアに置き換えられ、URL を一意にするために必要に応じて (n) が末尾に追加されます。
  • users
    String。新しい SharePoint サイトに追加するユーザーの一覧 (オプション)。次の形式で指定します。

    <UserInfo><item Email="{email address of user}" Name="{display name of user}"/>
    </UserInfo>
    
  • title
    String。新しいドキュメント ワークスペース サイトのタイトル。
  • documents
    String。後続の FindDwsDoc メソッドの呼び出しで使用するために保持する Windows SharePoint Services 用のドキュメントの一覧 (オプション)。新しいドキュメント ワークスペース サイトに共有添付ファイルを追加するときに Microsoft Office Outlook によって使用されます。この一覧は次の形式で返されます。

    <Documents><item ID="{document ID}" Name="{document name}"/>
    </Documents> 
    

戻り値

成功した場合、CreateDws メソッドが返す文字列は次の形式になります。

<Results>
    <Url>{url of the Document Workspace site}</Url>
    <DoclibUrl>{url of the document library in the Document Workspace site}</DoclibUrl>
    <ParentWeb>{title of the Document Workspace site</ParentWeb>
    <FailedUsers>
        <User Email="user_not_added@example.com"/>
        ...
    <FailedUsers>
</Results>

例外

例外の種類 条件

HTTP error code 401

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

DWSError.AlreadyExists (13)

指定された URL は既に存在します。

DwsError.QuotaExceeded (14)

この操作ではユーザーのクォータを超えます。

備考

CreateDws メソッドは、ドキュメント ワークスペース サイトを作成し、必要に応じて新しい SharePoint サイトにユーザーおよびドキュメントを追加します。このメソッドは、親 Web サイトと同じ言語でドキュメント ワークスペース サイトを作成しますが、その際に固有の権限を割り当てます。新しいサイトは親サイトから権限を継承しません。

ユーザーが適切な権限を持っていない場合、HTTP エラー応答で例外が発生します。

以下のコード例では、CreateDws メソッドを使用してドキュメント ワークスペース サイトを作成し、SharePoint サイトに新しいユーザーを追加します。この例で使用されているヘルパ関数の全文の詳細については、CanCreateDwsUrl メソッドを参照してください。

Try
    Dim strResult As String
    Dim strNewUser As String = "<UserInfo>" & _
        "<item Email='someone@example.com' Name='Someone'/>" & _
        "</UserInfo>"
    strResult = dwsWebService.CreateDws _
        ("site_name", strNewUser, "site_title", "")
    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 document workspace was successfully created.", _
            "Create DWS", 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
{
    string strResult = "";
    string strNewUser = "<UserInfo>" +
        "<item Email='someone@example.com' Name='Someone'/>" + 
            "</UserInfo>";
    strResult = dwsWebService.CreateDws
            ("site_name", strNewUser, "site_title", "");
    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 document workspace was successfully created.",
            "Create DWS", 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 名前空間