所以,我一直在使用功能升级一段时间,它适用于现有实例,但据我知道功能升级没有自动发生,你需要触发升级,它通过功能升级自动发生工具包在中央管理页面中。

问题是我想向站点列添加新字段,也将该字段添加到现有内容类型。

当上一个开发人员这样做时,他们没有使用任何功能版本控制,因此版本为0.0.0.0。

我递增到1.0.0.0,这将适用于现有网站。 但是如果我创建一个新站点,我很确定新的字段不会被创建,因为对于新站点,该功能将是1.0.0.0而不是1.0.0.0所以我不会触发升级。 所以这就是我到目前为止的目标。

元素_1_0_0_0.xml包含:

<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
  <Field ID="{A32453DB-4382-4F5C-8E33-8284AB160E47}" Name="Recurrent" DisplayName="$Resources:SPNLMeetings,Field_AgendaPointRecurrent_Name;" Description="$Resources:SPNLMeetings,Field_AgendaPointRecurrent_Description;" Group="$Resources:SPNLMeetings,Field_NationaleLoterijMeetingColumns_Group;" Type="Boolean" StaticName="Recurrent"  Required="FALSE" />
</Elements>
.

template.xml包含:

<Feature xmlns="http://schemas.microsoft.com/sharepoint/"
  ImageUrl="SPNL\spnl_feature.jpeg"
  Title="$Resources:SPNLMeetings,Feature_NLMeetingsContentTypes_Title"
  Description="$Resources:SPNLMeetings,Feature_NLMeetingsContentTypes_Description" Version="1.0.0.0">
  <UpgradeActions>    
    <VersionRange BeginVersion="0.0.0.0" EndVersion="0.9.9.9">
      <ApplyElementManifests>
        <ElementManifest Location="Fields\Elements_1_0_0_0.xml" />
      </ApplyElementManifests>
      <AddContentTypeField ContentTypeId="0x0120D52000D56C75F51E1BD54E9D59BBBA1925379A01"
          FieldId="{A32453DB-4382-4F5C-8E33-8284AB160E47}" PushDown="TRUE"/>
      <CustomUpgradeAction Name="ReorderFields"/>
    </VersionRange>
  </UpgradeActions>
</Feature>
.

功能清单的预览将如下所示:

<Feature xmlns="http://schemas.microsoft.com/sharepoint/" ImageUrl="SPNL\spnl_feature.jpeg" Title="$Resources:SPNLMeetings,Feature_NLMeetingsContentTypes_Title" Description="$Resources:SPNLMeetings,Feature_NLMeetingsContentTypes_Description" Version="1.0.0.0" DefaultResourceFile="SPNLMeetings" Id="5d35f78b-2211-4cd8-bcba-6db7ac456b74" ReceiverAssembly="NationaleLoterij.SharePoint.Meetings.Solution, Version=1.0.0.0, Culture=neutral, PublicKeyToken=212c981019c3ab5d" ReceiverClass="NationaleLoterij.SharePoint.Meetings.Solution.Features.NLMeetingsContentTypes.NLMeetingsContentTypesEventReceiver" Scope="Site">
  <UpgradeActions>
    <VersionRange BeginVersion="0.0.0.0" EndVersion="0.9.9.9">
      <ApplyElementManifests>
        <ElementManifest Location="Fields\Elements_1_0_0_0.xml" />
      </ApplyElementManifests>
      <AddContentTypeField ContentTypeId="0x0120D52000D56C75F51E1BD54E9D59BBBA1925379A01" FieldId="{A32453DB-4382-4F5C-8E33-8284AB160E47}" PushDown="TRUE" />
      <CustomUpgradeAction Name="ReorderFields" />
    </VersionRange>
  </UpgradeActions>
  <ActivationDependencies>
    <ActivationDependency FeatureTitle="$Resources:SPNL,Feature_NLBaseContentTypes_Title" FeatureDescription="$Resources:SPNL,Feature_NLBaseContentTypes_Description" FeatureId="e3356a10-dcd9-45a5-a1f5-6d9695b9c671" />
  </ActivationDependencies>
  <ElementManifests>
    <ElementManifest Location="Fields\Elements.xml" />
    <ElementManifest Location="ContentTypes\Elements.xml" />
    <ElementFile Location="AgendaPointProposedContentTypeResources\docsethomepage.aspx" />
    <ElementManifest Location="AgendaPointProposedContentTypeResources\Elements.xml" />
    <ElementFile Location="AgendaPointContentTypeResources\docsethomepage.aspx" />
    <ElementManifest Location="AgendaPointContentTypeResources\Elements.xml" />
  </ElementManifests>
</Feature>
.

有帮助吗?

解决方案

答案在这里: http://blogs.mofollow/archive/2012/02/06/212/02/06/feature-upgrade-adding-fields-to-content -types-and-sharepoint-application -lifecycle-management.aspx

更新内容类型 http:// msdn。 microsoft.com/en-us/library/aa543504.aspx 在任何情况下,不要在安装并激活该内容类型后更新内容类型定义文件的内容类型定义文件。 SharePoint Foundation不跟踪对内容类型定义文件所做的所有更改。因此,您没有可靠的方法,用于向子内容类型推迟到网站内容类型所做的所有更改。

更新子内容类型 http:// msdn .microsoft.com / en-US / Library / MS442695.aspx 您无法声明地将列添加到现有站点内容类型,换句话说,通过更新功能XML文件

许可以下: CC-BY-SA归因
scroll top