2009-09-22 62 views
0

我不得不使用SharePoint Web服務。我需要一個可以讓我刪除SharePoint子站點的Web服務。我試圖使用DeleteWorkspace方法(Meetings.asmx web服務),但它只能刪除滿足工作區的子站點(我使用從團隊站點派生的自定義模板)。任何幫助將不勝感激,謝謝。如何使用SharePoint Web服務刪除SharePoint子站點?

回答

1

令人驚訝!不,你不能這樣做......我知道!奇怪它會被遺漏。我敢肯定,如果我知道爲什麼會做出一些決定,但會打敗我。

唯一的選擇是部署自定義代碼 - 事件接收器或Web服務。

+0

@DJ:這並不奇怪。這些Web服務中缺少大量的功能。預計這將在SharePoint 2010中得到解決! – 2009-09-22 13:01:47

+0

來吧亞歷克斯,DeleteSite是否存在DeleteList等,但網絡對象是錯過?這在我的書中很奇怪。 – 2009-09-22 13:47:15

+0

@DJ:我想我們在這裏同意。你的觀點是,Web服務提供了不一致的功能。我的觀點是他們完全錯過了功能。最終結果:他們吮吸。 – 2009-09-22 14:02:25

1

不幸的是,對於開箱即用的Web服務,這是不可能的。 (它們只具有在網站集級別刪除的功能。)

您需要開發custom web service並將其部署到您的SharePoint場。

+0

謝謝您的回答。到目前爲止,SharePoint Web服務吸引了大量時間。 – Boris 2009-09-22 15:31:54

0

如果你想刪除一個網站嘗試使用dws web服務。

我用DWS.DeleteDWS(),其中functoins get_constant等簡單找回常數登錄和web服務像_vti_bin/dws.asmx

Public Function RemoveWSSSite(ByVal sPath As String, ByVal sSubSiteName As String) As Boolean 
     Dim DTConstant As New DTFrameWork.DTConstant 
     Dim SPDWS1 As New SPDws.Dws 
     Dim sSubsiteURL As String = "" 

     If (sSubSiteName = "") Then 
      sSubsiteURL = "" 
     Else 
      sSubsiteURL = sSubSiteName & "/" 
     End If 
     SPDWS1.PreAuthenticate = True 
     SPDWS1.Credentials = New System.Net.NetworkCredential(DTconst.Get_Constant_String_Value("SP_m_AdminUser"), DTconst.Get_Constant_String_Value("SP_m_AdminPassword"), DTconst.Get_Constant_String_Value("SP_m_SiteDomain")) 
     SPDWS1.Url = DTconst.Get_Constant_String_Value("SP_m_SiteServerName") & IIf(sPath.StartsWith("/"), "", "/") & sPath & IIf(sPath.EndsWith("/"), "", "/") & sSubsiteURL & DTconst.Get_Constant_String_Value("SP_m_dws_asmx") 
     Try 

      SPDWS1.DeleteDws() 

      Return True 
     Catch ex As Exception 
      Return False 
     End Try 
    End Function 
0

像本說,使用/_vti_bin/Dws.asmx應該是作品。再舉一例

public bool DeleteSubSite(string urlSubSite, string user, string passw, string domain) 
    { 
     bool retValue = true; 
     Dws docWS = new Dws(); 
     docWS.Url = urlSubSite + "/_vti_bin/Dws.asmx"; ; 
     docWS.Credentials = new System.Net.NetworkCredential(user, passw, domain); 

     try 
     { 
      docWS.DeleteDws(); 
     } 
     catch (SoapException soex) 
     { 
      retValue = false; 
     } 
     return retValue; 
    } 
1

如果您升級到SharePoint 2013,存在於Sites Web服務的新方法:DeleteWeb。它期望相對於您將該Web服務連接到的網站,刪除該子網站的URL。

--- Ferda

相關問題