WssInterop.DeleteWSSSite Method
Deletes a SharePoint workspace for the specified project.
Namespace: WebSvcWssInterop
Assembly: ProjectServerWebServices (in ProjectServerWebServices.dll)
Syntax
'Declaration
<SoapDocumentMethodAttribute("http://schemas.microsoft.com/office/project/server/webservices/WssInterop/DeleteWSSSite", RequestNamespace := "http://schemas.microsoft.com/office/project/server/webservices/WssInterop/", _
ResponseNamespace := "http://schemas.microsoft.com/office/project/server/webservices/WssInterop/", _
Use := SoapBindingUse.Literal, ParameterStyle := SoapParameterStyle.Wrapped)> _
Public Sub DeleteWSSSite ( _
projectUID As Guid _
)
'Usage
Dim instance As WssInterop
Dim projectUID As Guid
instance.DeleteWSSSite(projectUID)
[SoapDocumentMethodAttribute("http://schemas.microsoft.com/office/project/server/webservices/WssInterop/DeleteWSSSite", RequestNamespace = "http://schemas.microsoft.com/office/project/server/webservices/WssInterop/",
ResponseNamespace = "http://schemas.microsoft.com/office/project/server/webservices/WssInterop/",
Use = SoapBindingUse.Literal, ParameterStyle = SoapParameterStyle.Wrapped)]
public void DeleteWSSSite(
Guid projectUID
)
Parameters
- projectUID
Type: System.Guid
GUID of the project.
Remarks
The DeleteWSSSite method makes the following checks before it deletes a project workspace.
If the workspace is a top level site, DeleteWSSSite cannot delete it.
If the workspace site has any children, you must first delete the child sites.
The workspace must have the project workspace template features.
The project GUID associated with the workspace must match the projectUID parameter.
Project Server Permissions
Permission |
Description |
---|---|
Manage the project workspace site. Global permission. |
Examples
The following example checks whether a project has a workspace site, and if so, deletes the site after verifying the action.
The DeleteWorkspace sample method parameters are a validated WssInterop object, a Project object, and a project GUID. WssInteropWebSvc and ProjectWebSvc are arbitrary namespaces for the WebSvcWssInterop and WebSvcProject Web services. For general information about using the code example, see Prerequisites for Reference Code Samples.
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;
}
See Also
Reference
Other Resources
Windows SharePoint Services Infrastructure for Project Server