Site Columns Missing From Your Content Types?
Site Columns Missing From Your Content Types?
I was playing around with site columns and content types in an empty SharePoint solution. Here’s something interesting I found when I was deploying my package (solution). You can’t seem to have comment tags in the <FieldRefs> element when you’re defining the fields for your content type.
In my content type below based off the Item content type, I was just trying to add a custom site column (SessionName) I had created. However, when I went to look at the site columns after deploying it, the only site column was “Title” which came from Item.
<elements xmlns="http://schemas.microsoft.com/sharepoint/"> <!-- Parent ContentType: Item (0x01) --> <contenttype description="Mojo Item Content Type" group="Mojo Custom Content Types" id="0x01006e1d2ee8a874413dbe16d4ca2980cd0e" inherits="TRUE" name="SharePointProject1 - Item" version="0"> <fieldrefs> <!-- Testing --> <fieldref id="{36EFEDE7-3F78-4DB1-9A98-C94BF1E57133}" name="SessionName"> </fieldref></fieldrefs> </contenttype> </elements>
However, after I removed the comments:
<elements xmlns="http://schemas.microsoft.com/sharepoint/"> <!-- Parent ContentType: Item (0x01) --> <contenttype description="Mojo Item Content Type" group="Mojo Custom Content Types" id="0x01006e1d2ee8a874413dbe16d4ca2980cd0e" inherits="TRUE" name="SharePointProject1 - Item" version="0"> <fieldrefs> <fieldref id="{36EFEDE7-3F78-4DB1-9A98-C94BF1E57133}" name="SessionName"> </fieldref></fieldrefs> </contenttype> </elements>
The “SessionName” site column appeared in my content type after I redeployed the solution. Just something to keep in mind.










