2

I had content type based on Page and pages library, which uses this contennt type. I needed to add new columns to this list.

I created Elements.xml for fields:

<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/"> 
  <Field
       ID="{ae7b7e38-5245-4421-9bb5-769d49f5dc6f}"
       Name="Vacancy_Guid"
       DisplayName="$Resources:Job.Vacancy, Field_Vacancy_Guid"
       Type="Text"
       Required="FALSE"
       ShowInNewForm="FALSE"
       ShowInEditForm="FALSE"
       Group="$Resources:Vacancy, Field_Group_Lanit;">
  </Field>
  <Field
     ID="{8fc69746-f712-4773-bb39-3f2f6ec472e2}"
     Name="Vacancy_SendEmailToSubscriber"
     DisplayName="$Resources:Job.Vacancy, Field_Vacancy_SendEmailToSubscriber"
     Type="Choice"
     Required="TRUE"
     ShowInEditForm="TRUE"
     ShowInNewForm="TRUE"
     Group="$Resources:Job.Vacancy, Field_Group_Lanit;">
    <CHOICES>
      <CHOICE>$Resources:Job.Vacancy, Field_Vacancy_SendEmailToSubscriber_No;</CHOICE>
      <CHOICE>$Resources:Job.Vacancy, Field_Vacancy_SendEmailToSubscriber_Yes;</CHOICE>
    </CHOICES>
    <Default>$Resources:Job.Vacancy, Field_Vacancy_SendEmailToSubscriber_No;</Default>
  </Field>
</Elements>

Add write upgrade feature:

<?xml version="1.0" encoding="utf-8" ?>
<Feature xmlns="http://schemas.microsoft.com/sharepoint/" Version="1.0.0.0">
  <UpgradeActions>
    <VersionRange BeginVersion="0.0.0.0" EndVersion="0.9.9.9">
    <ApplyElementManifests>
      <ElementManifest Location="NewVacancyFields\Elements.xml" />
    </ApplyElementManifests>
    <AddContentTypeField ContentTypeId="0x010100C568DB52D9D0A14D9B2FDCC96666E9F2007948130EC3DB064584E219954237AF39002B15E832DE2AE644B71A1A556F1D8B3C" FieldId="{ae7b7e38-5245-4421-9bb5-769d49f5dc6f}"  PushDown="TRUE" />
    <AddContentTypeField ContentTypeId="0x010100C568DB52D9D0A14D9B2FDCC96666E9F2007948130EC3DB064584E219954237AF39002B15E832DE2AE644B71A1A556F1D8B3C" FieldId="{8fc69746-f712-4773-bb39-3f2f6ec472e2}"  PushDown="TRUE" />
    </VersionRange>
    </UpgradeActions>
</Feature>

I run upgrade feature by powershell and fields are in my existed content type. But these fields are not displayed in DispForm.aspx and EditForm.aspx. But in this time, I can check these fields in views and in list setting. Also if I delete fields from list settings and add once from content type it works normaly.

What I have done wrong?

  • both fields are not showing or only 1st one? – SP Developer Aug 10 '17 at 8:00
  • @VishalMPatil, both – Ivan Tikhonov Aug 10 '17 at 8:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.