次の方法で共有


WssInterop.DeleteWSSSite メソッド

指定されたプロジェクトのプロジェクト サイトは、の SharePoint サイトを削除します。

名前空間:  WebSvcWssInterop
アセンブリ:  ProjectServerServices (ProjectServerServices.dll 内)

構文

'宣言
<SoapDocumentMethodAttribute("https://schemas.microsoft.com/office/project/server/webservices/WssInterop/DeleteWSSSite", RequestNamespace := "https://schemas.microsoft.com/office/project/server/webservices/WssInterop/",  _
    ResponseNamespace := "https://schemas.microsoft.com/office/project/server/webservices/WssInterop/",  _
    Use := SoapBindingUse.Literal, ParameterStyle := SoapParameterStyle.Wrapped)> _
Public Sub DeleteWSSSite ( _
    projectUID As Guid _
)
'使用
Dim instance As WssInterop
Dim projectUID As Guid

instance.DeleteWSSSite(projectUID)
[SoapDocumentMethodAttribute("https://schemas.microsoft.com/office/project/server/webservices/WssInterop/DeleteWSSSite", RequestNamespace = "https://schemas.microsoft.com/office/project/server/webservices/WssInterop/", 
    ResponseNamespace = "https://schemas.microsoft.com/office/project/server/webservices/WssInterop/", 
    Use = SoapBindingUse.Literal, ParameterStyle = SoapParameterStyle.Wrapped)]
public void DeleteWSSSite(
    Guid projectUID
)

パラメーター

  • projectUID
    型: System.Guid

    プロジェクトの一意の識別子。

注釈

DeleteWSSSiteメソッド、 プロジェクト サイトを削除する前に、以下のチェックでは。

  • DeleteWSSSiteプロジェクト サイトは、最上位のサイト、それが削除できません。

  • プロジェクト サイトサイトがすべての子を持つ場合、子サイトを削除する必要があります。

  • プロジェクト サイトは、 プロジェクト サイトテンプレートの機能があります。

  • GUID は、 プロジェクト サイトに関連付けられているプロジェクトは、 projectUIDパラメーターに一致しなければなりません。

プロジェクト サーバーのアクセス許可

権限

説明

ManageWindowsSharePointServices

プロジェクト サイトサイトを管理することができます。グローバル アクセス権。

次に示しますとプロジェクトには、 プロジェクト サイトのサイトがあるかどうか、その場合は、サイトを削除、操作を確認した後。

サンプル メソッドのDeleteWorkspaceパラメーターには、検証済みWssInteropオブジェクト、 Projectオブジェクト、およびプロジェクトの一意の識別子です。WssInteropWebSvcとProjectWebSvcは、 WebSvcWssInteropサービス、 WebSvcProjectサービスの任意の名前空間です。このコード例を使用する方法の詳細については、 Project 2013 での ASMX ベースのコード サンプルの前提条件を参照してください。

using System;
using System.Collections.Generic;
using System.Text;
using System.Web.Services.Protocols;
using System.Windows.Forms;
using PSLibrary = Microsoft.Office.Project.Server.Library;
. . .
public bool DeleteWorkspace(WebSvcWssInterop.WssInterop wssInterop, 
    WebSvcProject.Project project, Guid projectUid)
{
    bool deleted = false;

    try
    {
        WebSvcWssInterop.ProjectWSSInfoDataSet dsWssInfo =
            wssInterop.ReadWssData(projectUid);
        bool workspaceExists = dsWssInfo.ProjWssInfo.Count > 0;

        if (workspaceExists)
        {
            string projectName = project.GetProjectNameFromProjectUid(projectUid,
                                        WebSvcProject.DataStoreEnum.PublishedStore);
            WebSvcWssInterop.ProjectWSSInfoDataSet.ProjWssInfoRow wssInfoRow =
               dsWssInfo.ProjWssInfo[0];

            string currentWorkspace = wssInfoRow.PROJECT_WORKSPACE_URL;

            string msg = string.Format(
                "Remove the link and delete the workspace site {0} for project {1}?",
                currentWorkspace, projectName);
            DialogResult result =
                MessageBox.Show(msg, "Delete Workspace",
                    MessageBoxButtons.YesNo, MessageBoxIcon.Question);

            if (result == DialogResult.Yes)
            {
                // Delete the workspace.
                wssInterop.DeleteWSSSite(projectUid);
                deleted = true;
            }
        }
    }
    catch (SoapException ex)
    {
        string errAttributeName;
        string errAttribute;
        string errMess = "".PadRight(30, '=') + "\r\n" + "Error: " + "\r\n";

        PSLibrary.PSClientError error = new PSLibrary.PSClientError(ex);
        PSLibrary.PSErrorInfo[] errors = error.GetAllErrors();
        PSLibrary.PSErrorInfo thisError;

        for (int i = 0; i < errors.Length; i++)
        {
            thisError = errors[i];
            errMess += "\n" + ex.Message.ToString() + "\r\n";
            errMess += "".PadRight(30, '=') + "\r\nPSCLientError Output:\r\n \r\n";
            errMess += thisError.ErrId.ToString() + "\n";

            for (int j = 0; j < thisError.ErrorAttributes.Length; j++)
            {
                errAttributeName = thisError.ErrorAttributeNames()[j];
                errAttribute = thisError.ErrorAttributes[j];
                errMess += "\r\n\t" + errAttributeName +
                           ": " + errAttribute;
            }
            errMess += "\r\n".PadRight(30, '=');
        }
        MessageBox.Show(errMess, "Error", MessageBoxButtons.OK,
            MessageBoxIcon.Error);
    }
    return deleted;
}

関連項目

参照先

WssInterop クラス

WssInterop メンバー

WebSvcWssInterop 名前空間

その他の技術情報

Windows SharePoint Services Infrastructure for Project Server