2011-08-31 25 views
0

我在ContentType xml中为货币字段指定了以下字段。内容类型中的任何其他必填字段都按预期为列表栏中的这一项工作,它不会按需显示。我真的看不出有什么不对,谁能帮忙吗?必需的字段/ FieldRef内容类型对于货币无法正常工作

<Field ID="{060e50ac-e9c1-4d3c-b1f9-de0bcac300f6}" Name="Price" DisplayName="Price" Type="Currency" Decimals="2" Min="0" Required="TRUE" Group="MyGroup" ColName="Price"/> 

... 

<ContentType ID="0x01000a35b7a7e98c46248e063d79ddd67f6c" 
      Name="MarketPlaceContentType" 
      Group="MyGroup" 
      Description="Market place item, holds Title, Description, Category etc" 
      Inherits="FALSE" 
      Overwrite="TRUE" 
      Version="0"> 


<FieldRef ID="{060E50AC-E9C1-4D3C-B1F9-DE0BCAC300F6}" Name="Price" DisplayName="Price" Required="TRUE" />  
+1

的是价格标记为网站内容类型需要,当你在你的列表设置,单击内容类型(开启,如果你不允许管理内容类型见内容类型)? –

+0

谢谢,但我如何通过部署来管理网站内容类型? – Burt

+1

我问这个问题的原因是因为列表的内容类型将覆盖网站内容类型的设置。如果你想通过部署来管理这个,你如何将内容类型与你的列表关联起来?你在使用列表定义吗?如果是这样,请确保Price字段在schema.xml中标记为必需。 –

回答

1

我正在这与伯特,可以在这个问题上分享更多的光,对我们在做什么错误的指导将是伟大的!

1)我们创建了一个内容类型。

<Elements xmlns="http://schemas.microsoft.com/sharepoint/"> 

    <Field ID="{060e50ac-e9c1-4d3c-b1f9-de0bcac300f6}" Name="Price" DisplayName="Price" Type="Text" Required="False" Group="" ColName="Price" StaticName="Price" /> 

    <!-- Parent ContentType: Item (0x01) --> 
    <!-- set Inherits="FALSE" so the new template is picked up--> 
    <ContentType ID="0x01000a35b7a7e98c46248e063d79ddd67f6c" 
       Name="MarketPlaceContentType" 
       Group="" 
       Description="Market place item, holds Title, Description, Category etc" 
       Inherits="FALSE" 
       Version="0"> 
     <FieldRefs> 
      <FieldRef ID="{060E50AC-E9C1-4D3C-B1F9-DE0BCAC300F6}" Name="Price" DisplayName="Price" Required="TRUE" /> 
     </FieldRefs> 
    </ContentType> 
</Elements> 

2)我们已经使用此内容类型

<

?xml version="1.0" encoding="utf-8"?> 
<List xmlns:ows="Microsoft SharePoint" Title="Lists - MarketPlace" FolderCreation="FALSE" Direction="$Resources:Direction;" Url="Lists/Lists-MarketPlace" 
     BaseType="0" xmlns="http://schemas.microsoft.com/sharepoint/" NavigateForFormsPages="False" DisableAttachments="true" BrowserFileHandling="permissive" EnableContentTypes="TRUE"> 
    <MetaData> 
     <ContentTypes> 
      <ContentType ID="0x01000a35b7a7e98c46248e063d79ddd67f6c" Name="MarketPlaceContentType" 
         Group="" Description="Market place item, holds Title, Description, Category etc" > 
       <FieldRefs> 
          <FieldRef ID="{060E50AC-E9C1-4D3C-B1F9-DE0BCAC300F6}" Name="Price" DisplayName="Price" Required="true" /> 
        </FieldRefs> 
      </ContentType> 
     </ContentTypes> 
     <Fields> 
      <Field ID="{060e50ac-e9c1-4d3c-b1f9-de0bcac300f6}" Name="Price" DisplayName="Price" Type="Text" Required="True" Group="" /> 
     </Fields> 
     <Views> 
      <View BaseViewID="0" Type="HTML" MobileView="TRUE" TabularView="FALSE"> 
       <Toolbar Type="Standard" /> 
       <XslLink>main.xsl</XslLink> 
       <RowLimit Paged="TRUE">30</RowLimit> 
       <ViewFields> 
        <FieldRef Name="LinkTitleNoMenu"> 
        </FieldRef> 
       </ViewFields> 
       <Query> 
        <OrderBy> 
         <FieldRef Name="Modified" Ascending="FALSE"> 
         </FieldRef> 
        </OrderBy> 
       </Query> 
       <ParameterBindings> 
        <ParameterBinding Name="AddNewAnnouncement" Location="Resource(wss,addnewitem)" /> 
        <ParameterBinding Name="NoAnnouncements" Location="Resource(wss,noXinviewofY_LIST)" /> 
        <ParameterBinding Name="NoAnnouncementsHowTo" Location="Resource(wss,noXinviewofY_ONET_HOME)" /> 
       </ParameterBindings> 
      </View> 
      <View BaseViewID="1" Type="HTML" WebPartZoneID="Main" DisplayName="$Resources:core,objectiv_schema_mwsidcamlidC24;" DefaultView="TRUE" MobileView="TRUE" 
        MobileDefaultView="TRUE" 
        SetupPath="pages\template\marketpgviewpage.aspx" ImageUrl="/_layouts/images/generic.png" Url="AllItems.aspx" > 
       <Toolbar Type="Standard" /> 
       <XslLink Default="TRUE">main.xsl</XslLink> 
       <RowLimit Paged="TRUE">10</RowLimit> 
       <ViewFields> 
        <FieldRef Name="MarketplaceCategories" DisplayName="Category"></FieldRef> 
        <FieldRef Name="LinkTitle" DisplayName="Title"></FieldRef> 
        <FieldRef Name="Author" DisplayName="Name" /> 
        <FieldRef Name="Created" Format="DateOnly" DisplayName="Date"/> 
        <FieldRef Name="Locations" DisplayName="Location"></FieldRef> 
        <FieldRef Name="MarketplaceItemExpiryDate" DisplayName="Expiry Date" Format="DateOnly"></FieldRef> 
       </ViewFields> 
       <Query> 
        <OrderBy> 
         <FieldRef Name="ID" Ascending="False" /> 
        </OrderBy> 
       </Query> 
       <ParameterBindings> 
        <ParameterBinding Name="NoAnnouncements" Location="Resource(wss,noXinviewofY_LIST)" /> 
        <ParameterBinding Name="NoAnnouncementsHowTo" Location="Resource(wss,noXinviewofY_DEFAULT)" /> 
       </ParameterBindings> 
      </View> 
      <View BaseViewID="2" Type="HTML" WebPartZoneID="Main" DisplayName="Items By Category" DefaultView="false" MobileView="TRUE" 
        MobileDefaultView="TRUE" 
        SetupPath="pages\template\marketpgviewpage.aspx" ImageUrl="/_layouts/images/generic.png" Url="ItemsByCategory.aspx" > 
       <Toolbar Type="Standard" /> 
       <XslLink Default="TRUE">main.xsl</XslLink> 
       <RowLimit Paged="TRUE">10</RowLimit> 
       <ViewFields> 
        <FieldRef Name="LinkTitle" DisplayName="Title"></FieldRef> 
        <FieldRef Name="Price"/> 
       </ViewFields> 
       <Query> 
        <Where> 
         <Eq> 
          <FieldRef Name="MarketplaceCategories" /> 
          <Value Type="Text">{MarketplaceCategories}</Value> 
         </Eq> 
        </Where> 
        <OrderBy> 
         <FieldRef Name="Created" Ascending="False" /> 
        </OrderBy> 
       </Query> 
       <ParameterBindings> 
        <ParameterBinding Name="NoAnnouncements" Location="Resource(wss,noXinviewofY_LIST)" /> 
        <ParameterBinding Name="NoAnnouncementsHowTo" Location="Resource(wss,noXinviewofY_DEFAULT)" /> 
        <ParameterBinding Name="MarketplaceCategories" Location="Control(tcCategories, SelectedItem)"/> 
       </ParameterBindings> 
      </View> 


     </Views> 
     <Forms> 
      <Form Type="NewForm" Url="NewForm.aspx" SetupPath="pages\form.aspx" WebPartZoneID="Main"/> 
      <Form Type="EditForm" Url="EditForm.aspx" SetupPath="pages\form.aspx" WebPartZoneID="Main" /> 
      <Form Type="DisplayForm" Url="CustomDisplayForm.aspx" SetupPath="features\$SharePoint.Feature.DeploymentPath$\MarketPlace\displayitem.aspx" UseLegacyForm="true" WebPartZoneID="Main" Template="MarketPlaceDisplayForm"/> 
     </Forms> 
    </MetaData> 
</List> 

3)我们的内容类型都有,我们想修改各个领域创建的列表定义他们的属性,但我们无法轻松更新它们。

任何关于我们做错的指针都会很棒!

1

我们已经解决了这个问题,对于任何阅读此内容并花费数小时精力的人,我都会这么做!

内容类型允许您创建基本的数据结构以供重用,例如, JumbleSale物品。该项目具有作为站点列已在SharePoint中存在的各种属性,例如标题。它还具有一些“自定义项目”特有的属性,例如“位置”和一些对项目唯一的属性,例如“价钱。

JumbleSale内容类型定义了一个将所有这些属性保存在一起的结构。内容类型的独特的新字段在内容类型的elements.xml中定义。 'CUSTOM PROJECT'和SharePoint网站栏中重复使用的字段通过FieldRef属性引用(注意:'CUSTOM PROJECT'网站栏可以在Custom'CUSTOM PROJECT'Fields wsp中定义)。

通过schema.xml声明的列表定义引用了这些内容类型定义。他们还列出了视图和过滤器。 (注意:OTB Visual studio会将内容类型定义复制到schema.xml中的内容类型字段引用部分中,为了避免复杂性,请删除重复的FieldRef。) 要更新列表定义中的任何SharePoint网站列的displayName : 通过将字段定义复制到模式中的字段部分来重新声明字段。 更新displayName属性 Add Sealed =“TRUE”

更新视图以显示您希望显示的内容类型的列。

看看这个链接,类似的情景,http://spandothers.wordpress.com/2009/01/17/renaming-the-title-column-in-a-sharepoint-list/