Поделиться через


Метод 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 .

Разрешения Project Server

Разрешение

Описание

ManageWindowsSharePointServices

Позволяет пользователю управлять сайт проекта сайта. Глобальное разрешение.

Примеры

В следующем примере проверяется ли в проекте имеется сайт проекта сайта и если да, удаление сайта после проверки действие.

The DeleteWorkspace sample method parameters are a validated WssInterop object, a Project object, and the unique identifier of the project. WssInteropWebSvc and ProjectWebSvc are arbitrary namespaces for the WebSvcWssInterop service and the WebSvcProject service. For information about using the code example, see Необходимые условия для образцов кода на основе ASMX в Project 2013.

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