I have the following field specified in my ContentType xml for a currency field. Any other required field in the content type works as expected for the list bar this one, it doesn't show as required. I really can't see what is wrong, can anyone help please?
<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="0x01000a35b7a7开发者_StackOverflowe98c46248e063d79ddd67f6c"
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" />
i'm working on this with Burt and can share a bit more light on the issue, guidance on what we are doing wrong would be great!!
1) We've created a content type.
E.g
<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) We've created a list definition using this content type
<
?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) Our content types have various fields that we want to amend their attributes but we are unable to update them easily.
Any pointers on what we are doing wrong would be great !!!!
We've resolved the issue, for anyone who reads this and spends hours going mental like i did!!!!
Content Type allows you to create your basic data structure for reuse, e.g. JumbleSale item. The item has various properties that already exist in SharePoint as site columns, e.g Title. It also has some properties that are unique to 'CUSTOM PROJECT', e.g Location and some that are unique to the item, e.g. Price.
The JumbleSale content type defines a structure that holds all these properties together. New fields unique to the content type are defined in the elements.xml of the content type. Reused fields from 'CUSTOM PROJECT' and SharePoint site columns are referenced via FieldRef properties (NB. 'CUSTOM PROJECT' Site columns could be defined in the Custom'CUSTOM PROJECT'Fields wsp).
List definition's, declared via the schema.xml, reference these content types definitions. They also list the Views and Filters. (NB. OTB Visual studio will copy the content type definition into the content type field ref section in the schema.xml. To avoid complications, remove the duplicate FieldRef's.) To update the displayName of any SharePoint Site Column in your list definition: Redeclare the fields by copying the field definition to the Field section in the schema. Update the displayName property Add Sealed=”TRUE”
Update the views to display the columns of the content type you wish to display.
Look at this link for similar scenario, http://spandothers.wordpress.com/2009/01/17/renaming-the-title-column-in-a-sharepoint-list/
精彩评论