none
why new list form is asking for content type ?

    Question

  • Hello,

    I have created custom list named List1 programmatically having two content types item and myitem.

    I am updating data in List1 programmatically from excel file which is working fine.

    When I edit the List1 item , its displaying item content type intead of myitem.

    

    Issue : I do not want this dropdown to have.

    Note : In list setting myitem content type has been set as default,even its asking for the content type to be selected.

    Can anyone please let me know the way to remove this content type selection and list form should get load with myitem content type ?

    Thanks and Regards,

    Dipti


    Dipti Chhatrapati

    Friday, July 18, 2014 9:30 AM

Answers

  • Hi All,

    Thank you for the reply,however  root cause for this issue was - when item was being updated programmatically it was not updating content type for item which has been resolved by following link:

    http://asadewa.wordpress.com/2007/11/19/adding-a-custom-content-type-specific-item-on-a-sharepoint-list/

    Following code has done the job for me:

    SPContentType itemtype = list.ContentTypes["myitem"];
    SPListItem newitem = items.Add();
    newitem["ContentTypeId"] = itemtype.Id; //VOILA!
    newitem.Update();

    Hope it helps others.

    Thanks and Regards,


    Dipti Chhatrapati

    Friday, July 18, 2014 12:51 PM

All replies

  • check this

    http://sharepoint.stackexchange.com/questions/40979/programatically-how-do-i-change-the-default-document-content-type-of-a-docume

    http://shahjinesh11.wordpress.com/2013/07/30/how-to-remove-content-type-from-list-library-programmatically/

    http://blogs.msdn.com/b/chandru/archive/2008/08/25/content-type-setting-up-default-content-type-programmatically.aspx

    http://www.ashokraja.me/tips/How-to-programmatically-set-a-content-type-as-default-content-type-in-a-SharePoint-2013-List
    • Edited by sk2014 Friday, July 18, 2014 10:29 AM
    Friday, July 18, 2014 10:29 AM
  • using ui

    http://mscerts.programming4.us/sharepoint/sharepoint%202010%20%20%20remove%20a%20content%20type%20from%20a%20list%20or%20document%20library.aspx

    using power shell

    http://sharepoint.stackexchange.com/questions/7429/how-to-remove-the-builtin-item-content-type-from-a-list-using-powershell

    http://get-spscripts.com/2010/11/add-and-remove-site-content-types-from.html

    Friday, July 18, 2014 10:33 AM
  • Hi All,

    Thank you for the reply,however  root cause for this issue was - when item was being updated programmatically it was not updating content type for item which has been resolved by following link:

    http://asadewa.wordpress.com/2007/11/19/adding-a-custom-content-type-specific-item-on-a-sharepoint-list/

    Following code has done the job for me:

    SPContentType itemtype = list.ContentTypes["myitem"];
    SPListItem newitem = items.Add();
    newitem["ContentTypeId"] = itemtype.Id; //VOILA!
    newitem.Update();

    Hope it helps others.

    Thanks and Regards,


    Dipti Chhatrapati

    Friday, July 18, 2014 12:51 PM
  • Hi,

    Thanks for your sharing.

    cheers,

    Jason


    Jason Guo
    TechNet Community Support

    Monday, July 21, 2014 8:10 AM
    Moderator