views:

189

answers:

1

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.

A: 

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:

<Data>
     <Rows>
        <Row>
           <Field Name="Title">Outgoing e-mail settings</Field>
           <Field Name="FSObjType">1</Field>
        </Row>
     </Rows>
  </Data>

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.

naivists