2009-07-16 69 views
5

我已經完成SharePoint 2007的AddList和AddListFromFeature缺少模板列和數據內容

  • 深入瞭解SharePoint我創建了基於項目的任務模板
  • 我刪除了大部分默認列一個清單,並添加了新的自定義列
  • 我使用新的格式
  • 然後添加數據,我做了「另存爲模板」,並選擇保存模板與內容

什麼是工作

現在,當我使用模板來創建新的SharePoint列表裏面它完美的作品。自定義列已存在,並且數據全部按預期填充。

什麼不工作

然而,當我使用的SharePoint Web服務提供了AddListAddListFromFeature方法創建新的列表,但它只是基於了與原有項目的任務模板默認列沒有數據

我已經試過

  • 我嘗試以下建議in the article from Phase 2設置一個自定義模板ID,但只阻止我使用所有的模板(不再上市的時候我做了「創建」)。
  • 我仍然試圖找出是否this article applies - 它似乎是一個類似的問題,但適用於網站而不是列表。
  • 大約一年前,我發現另一個人是having the same problem

系統設置

與SharePoint 2007(我想?)工作,使用PHP與的NuSOAP連接。由於我已將項目添加到列表,創建列表和讀取數據,因此連接絕對有效。

代碼示例

請求 - 對第2階段的方法模板上面

<?xml version="1.0" encoding="ISO-8859-1"?><SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns2034="http://tempuri.org"><SOAP-ENV:Body> 
<AddListFromFeature xmlns="http://schemas.microsoft.com/sharepoint/soap/"> 
    <listName>2Test Milestone Release</listName> 
    <description>Testing this out</description> 
    <featureID>{00BFEA71-513D-4CA0-96C2-6A47775C0119}</featureID> 
    <templateID>151</templateID> 
</AddListFromFeature></SOAP-ENV:Body></SOAP-ENV:Envelope> 

響應 - 由於失敗templateID不被認可

<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><soap:Fault><faultcode>soap:Server</faultcode><faultstring>Exception of type 'Microsoft.SharePoint.SoapServer.SoapServerException' was thrown.</faultstring><detail><errorstring xmlns="http://schemas.microsoft.com/sharepoint/soap/">Cannot complete this action. 

Please try again.</errorstring><errorcode xmlns="http://schemas.microsoft.com/sharepoint/soap/">0x81072101</errorcode></detail></soap:Fault></soap:Body></soap:Envelope> 

我難倒!所以,如果你能幫助 - 我會是一個非常快樂的人!提前致謝!

+0

[1]:http://msdn.microsoft.com/en-us/library/lists.lists.addlist.aspx [2]:http://msdn.microsoft.com/en-us/library /lists.lists.addlistfromfeature.aspx [3]:http://www.phase2.com/blog/?p = 89 [4]:http://blogs.msdn.com/harsh/archive/2006/08/04/687984.aspx [5]:http://social.technet.microsoft.com/Forums/ zh-CN/sharepointdevelopment/thread/9a8da931-ca44-45be-8d4e-e762adcde238 – Joshua 2009-07-16 18:21:55

回答

1

我會追逐爲什麼你不能通過接口創建列表,這兩個Web服務調用在創建自定義模板時似乎沒有包含重要參數,我們來分析查詢字符串:

新建項目任務(開箱即用)

http://site/_layouts/new.aspx?FeatureId= {00bfea71-513d-4ca0-96c2-6a47775c0119} & ListTemplate = 150

新建項目任務自定義(保存在列表模板庫)

http://site/_layouts/new.aspxCustomTemplate = PT6.stp & FEATUREID = {00bfea71-513d-4ca0-96c2-6a47775c0119} & ListTemplate = 150

新項目任務自定義(的manifest.xml編輯以151)

http://site/_layouts/new.aspxCustomTemplate = PT6.stp & FEATUREID = {00bfea71-513d-4ca0-96c2-6a47775c0119} & ListTemplate =

他們所有的工作,所以在這裏我的觀點是,Web服務是一種沒有沒有自定義模板,或者它有一些祕密魔法(在列表定義中常見),因爲即使在UI中指定ListTemplate而不顯式定製也不行。

如果你不能用這種明顯的限制得到解決,我的建議是:

  1. .NET,注意this post有一些巫術在第一個評論,如果你碰巧得到同樣的錯誤
  2. http://site/_layouts/new.aspx做一個IFRAME? CustomTemplate = PT6.stp & FeatureId = {00bfea71-513d-4ca0-96c2-6a47775c0119} & ListTemplate = 150作爲源代碼並使用javascript填充字段,然後觸發OK按鈕單擊,進行一些完整的頁面加載過渡並且它甚至會看起來不錯。從同一個域中進行

方法2層的需求,如果你不是來自同一個域(不太可能),你需要在SharePoint網站內創建一個頁面包含這個破解運行你的PHP,它可以作爲簡單的作爲一個帶有內容編輯器Web部件的Web部件頁面,您可以閱讀一些查詢字符串參數,將它們放在字段上,觸發OK並等待頁面更改,以便重定向到「成功」頁面。

編輯:我好奇的看着New.aspx的來源,它有這個小片段(bIsCustomTemplate = strCustomTemplate = NULL,strCustomTemplate =查詢字符串 「CustomTemplate」!):

我看着反彙編的代碼,但我不認爲我們可以在這裏發佈它,但它只能證明UI從帖子(Request.Form)構建它並查找CustomTemplate參數,並且Web Service只有那些方法是可以的不指定自定義模板。