在列表实例 xml 中添加 SPFolder
我创建了一个自定义列表,并包含基本部分(schema.xml、列表模板等)以将其打包为 .wsp。我定义了一个列表实例,但我想向 xml 添加一些文件夹。我知道您可以使用...添加 SPListItems,但我不确定如何添加 SPFolder。最终,我想默认将一些 SPFolders 添加到列表实例中,但我似乎找不到任何这样做的示例。我想知道是否有人有一些与如何执行此操作相关的建议和示例代码。
I've create a custom list and included the basic pieces (schema.xml, list template,..) to package it as a .wsp. I have a list instance defined, but I would like to add some folders to the xml. I know you can add SPListItems using ..., but I'm not sure how to add an SPFolder. Ultimately I want to add some SPFolders to the list instance by default, but I just can't seem to find any examples of doing this. I was wondering if anyone has some suggestions and sample code related to how to do this.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我的答案只是猜测这种情况是如何发生的,我的家用计算机上没有可以测试它的 SharePoint 设置。
我想知道,如果您在 列出实例 xml。这看起来像:
编辑:似乎我不是唯一想到这种解决方案的人,但似乎这个技巧不适用于自定义列表,仅适用于自定义文档库: http://www.notesfor.net/ post/2009/02/16/Deploy-a-Custom-SPList-with-folders-from-onetxml.aspx 但是,本文为您解释了一种解决方法。
My answer is just a guess about how this could happen, I have no SharePoint setup on my home computer where I could test it.
I wonder, what would happen if you included the field
FSObjType
in your list instance xml. This would look like:EDIT: Seems like I was not the only one to think of such a solution, but it seems that the trick won't work on custom lists, only in custom document libraries: http://www.notesfor.net/post/2009/02/16/Deploy-a-Custom-SPList-with-folders-from-onetxml.aspx However, this article explains a workaround for you.