Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>To answer the second part of your question, this a tricky thing because of the fact that changes to contenttypes on the sitecollection won´t be pushed down to the lists where it´s used. A "copy" is essentially made of the fields in the sitecollection and there is no more link between them after you add a contenttype to the list. I think this is due to the fact that you are supposed to make changes to lists without it affecting the sitecollection. Anyhow my contribution to this "problem", and how I have solved it, involves making the xml the "master" and in a featurereceiver I pull up the xml and find all places where the contenttype is used and from there update the contenttypes (really the fieldrefs) on list level to match the one in the xml. The code goes something like:</p> <pre><code>var elementdefinitions = properties.Feature.Definition.GetElementDefinitions(); foreach (SPElementDefinition elementDefinition in elementdefinitions) { if (elementDefinition.ElementType == "ContentType") { XmlNode ElementXML = elementDefinition.XmlDefinition; // get all fieldrefs nodes in xml XmlNodeList FieldRefs = ElementXML.ChildNodes[0].ChildNodes; // get reference to contenttype string ContentTypeID = ElementXML.Attributes["ID"].Value.ToString(); SPContentType ContentType = site.ContentTypes[new SPContentTypeId(ContentTypeID)]; // Get all all places where the content type beeing used IList&lt;SPContentTypeUsage&gt; ContentTypeUsages = SPContentTypeUsage.GetUsages(ContentType); } } </code></pre> <p>The next thing is to compare the fieldrefs in xml xml with the fields on the list (done by the ID attribute) and making sure that they are equal. Unfortunately we can´t update all things on the SPFieldLink class (the fieldref) and (yes I know it´s not supported) here I have actually used reflection to update those values (f.e. ShowInEditForm ).</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload