当模块中指定多个 Web 部件文件时,仅将一个 Web 部件添加到可湿性粉剂库
我正在尝试部署多个 Web 部件作为同一功能的一部分。 SharePoint 本身似乎很高兴地通过在单个 Module 元素中指定多个 File 元素来做到这一点(请参阅 C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\FEATURES\SearchWebParts ); 就我而言,仅将第一个 Web 部件添加到 Web 部件库,尽管添加到“杂项”组而不是“属性”元素中指定的组。
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<Module Name="WebPartPopulation" Url="_catalogs/wp" Path="WebParts">
<File Url="Test1.webpart" Type="GhostableInLibrary">
<Property Name="Group" Value="MyGroup" />
</File>
<File Url="Test2.webpart" Type="GhostableInLibrary">
<Property Name="Group" Value="Mygroup" />
</File>
</Module>
</Elements>
我的 .webpart 文件与 elements 文件位于同一目录中; 我尝试在 Elements 元素上设置 Path="" 但没有部署任何内容。 切换两个 File 元素会部署 Test2.webpart 而不是 Test1,并且 Test1.webpart 不会在功能激活时添加。 每个模块添加一个文件确实有效,但这意味着复制模块元素。
我正在自动关闭 Property 元素,但这肯定不是罪孽? 我究竟做错了什么?
I'm trying to deploy multiple web parts as part of the same feature. SharePoint itself seems to do this quite happily by specifying multiple File elements in a single Module element (see C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\FEATURES\SearchWebParts
); in my case, only the first web part is added to the Web Parts gallery, albeit to the Miscellaneous group instead of the group specified in the Property element.
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<Module Name="WebPartPopulation" Url="_catalogs/wp" Path="WebParts">
<File Url="Test1.webpart" Type="GhostableInLibrary">
<Property Name="Group" Value="MyGroup" />
</File>
<File Url="Test2.webpart" Type="GhostableInLibrary">
<Property Name="Group" Value="Mygroup" />
</File>
</Module>
</Elements>
My .webpart files are located in the same directory as the elements file; I tried setting Path="" on the Elements element but nothing gets deployed then. Switching around the two File elements deploys Test2.webpart instead of Test1 and Test1.webpart is not added on feature activation. Adding a single File per Module does work but that means duplicating the Module elements.
I'm self-closing the Property elements but that's surely not a sin?? What am I doing wrong?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
上面的内容似乎是正确的:在重新启动和睡眠后,当我第二天返回时,两个 Web 部件最终都位于正确的组中。 令人惊讶的是,我经常发现重新启动可以修复像这样的奇怪的 SharePoint 问题,而 iisreset 也不会触及这些问题。 也许其他服务应该重置/缓存这些东西?
The above would seem to be correct: after a reboot and a sleep, both web parts ended up in their proper groups when I came back to it the next day. It's surprising how often I find a reboot fixes up weird SharePoint things like this that even and iisreset won't touch. Maybe other services that should be reset/caching these things?