删除项目网站指定项目的 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 权限
权限 |
说明 |
---|---|
允许用户管理项目网站网站。全局权限。 |
示例
下面的示例检查项目是否项目网站网站,如果跟随,删除网站确认操作后。
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 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;
}
另请参阅
引用
其他资源
Windows SharePoint Services Infrastructure for Project Server