2009-07-16 44 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只有那些方法是可以的不指定自定义模板。