none
Custom Edit Forms and Content Types RRS feed

  • Question

  • Hi,
     
    I am trying to update the "Content Type" in a document library using a Custom Edit From that I have created.

    All the other fields update correctly, but the "Content Type" field does not.

    Anyone know why????

    <SharePoint:FormField runat="server" id="ff23{$Pos}" controlmode="Edit" fieldname="ContentType" __designer:bind="{ddwrt:DataBind('u',concat('ff23',$Pos),'Value','ValueChanged','ID',ddwrt:EscapeDelims(string(@ID)),'@ContentType')}" />
    Wednesday, September 24, 2008 9:46 PM

Answers

  • Hi, 

    The content type column is not editable, like the modified column. That is why the content type filed is not updated.

     

    You can edit the content type in Site Settings > Site Content Type Gallery.

     

    Hope the information can be helpful.

    -lambert


    Posting is provided "AS IS" with no warranties, and confers no rights.
    Monday, September 29, 2008 4:06 AM

All replies

  • Hi, 

    The content type column is not editable, like the modified column. That is why the content type filed is not updated.

     

    You can edit the content type in Site Settings > Site Content Type Gallery.

     

    Hope the information can be helpful.

    -lambert


    Posting is provided "AS IS" with no warranties, and confers no rights.
    Monday, September 29, 2008 4:06 AM
  • This is 'kind-of' the same issue we are having.

    We have created a custom content type that inherits from Document. We have also written a c# utility to populate the new fields from our content type for each document in our document library. Obviously we would like to change the Content Type of each item from "Document" to "Custom Document Type".

    However when we run the following:

    // set remaining properties
    listItem["ContentTypeId"] = customCType.Id;
    listItem["Content Type"] = = customCType.Name;
    listItem["FieldNumberOne"] = "Hello";
                               
    // update changes
    listItem.Update();

    If you follow the code through, the Content Type information is set properly but after executing the listItem.Update() command the content type of the item is reset to "Document". I am guessing that this is a feature of SharePoint so that you don't change the content type of an item from "Document" to "Task" so that fields are not messed up between conversions. But IMO it should work if you change the content type from Document to a child content type of Document.

    If there is no way around this, I'm guessing that we will have to create new items with the same properties and assign the custom content type. If this is the case, can version history be easily be brought across from the old items?

    Jay
    Friday, March 13, 2009 9:32 PM