0
votes

As you may know, in SharePoint you can create a List Content Type (e.g. "Web folder") then add some columns for this content type (e.g. Name and Path).

How to create a custom Content Type instance within a SharePoint List?

My List is like below

ProductList
  WebFolder1
    Page1.aspx
    Page2.aspx
  WebFolder2
    Page3.aspx

I'm using the below xml to be passed to the sharepoint web service and i'd like to create a new "Web folder" under the WebFolder1:

<Method ID="1" Cmd="New">
<Field Name="FSObjType">1</Field>
<Field Name="Name">TestWebFolder11</Field>
<Field Name="BaseName">WebFolder1/TestWebFolder11</Field>
</Method>

And it creates a Folder content type under WebFolder1, whereas I'd need to create a "Web folder" content type instead.

How to create a custom content type instance programmatically?

Many thanks,

1

1 Answers

0
votes

Simply, there is a fieldname called "ContentType" which can be set:

<Method ID="1" Cmd="New">
<Field Name="ContentType">Web folder</Field> // this is case-sensitive
<Field Name="BaseName">WebFolder1/TestWebFolder11</Field>
</Method>

so other properties are not required and the name of the my webfolder becomes "TestWebFolder11" and will be located under the "WebFolder1".