一つのレコードをリストに追加して、どのConttent Typeを使うかを指定します。

943 ワード

http://blog.the-dargans.co.uk/2007/04/programmatically-adding-items-to.html http://asadewa.wordpress.com/2007/11/19/adding-a-custom-content-type-specific-item-on-a-sharepoint-list/
Shott walk through:
  • Get a instance of the list you want to add the item to.
  • Add a new item to the list:  SPListItem newItem = list.Items.Add();
  • To bind you new item to a content type you have to set the content type id for the new item:newItem["ContentTypeId"] = <Id of the content type>;.
  • Set the fields specified within your content type.
  • Comit your changes:  newItem.Update();