April 3, 2007

MOSS: Creating folders to list in ONET.XML

Problem:
One can easily create items to lists in ONET.XML, but how to create folders?

Solution:
Key is to use ContentTypeId and FSObjType.
<Row>
  <Field Name='ContentTypeId'>0x0120</Field>
  <Field Name='FSObjType'>1</Field>
  <Field Name='Title'>folder title</Field>
  <Field Name='LinkTitle'>folder title</Field>
</Row>

4 comments:

  1. How do we create sub folders inside a folder in onet.xml?

    ReplyDelete
  2. This comment has been removed by the author.

    ReplyDelete
  3. Rows
    Row
    Field Name='FSObjType'1 _Field
    Field Name='Title' folder title _Field
    Field Name='BaseName'folderb _Field
    _Row

    Row
    Field Name='FSObjType'1 _Field
    Field Name='Title'subfolder title _Field
    Field Name='BaseName'folderb/subfolders _Field
    _Row
    _Rows

    ReplyDelete
  4. Thanks for the tip about the folders.
    However, it is still not clear to me how to create the subfolders

    ReplyDelete