Wednesday, June 30, 2010

Define Custom SharePoint Content Type

To create a custom SharePoint Content Type in Visual Studio:

  1. New SharePoint Empty Project
  2. Add New Item à SharePoint Content Type
  3. Select the appropriate Base Content Type

ContentTypeName.xml

<?xml
version="1.0"
encoding="utf-8"?>

<Elements
Id="7111ad17-7d38-4a2b-8d8d-b1410b19f973"
xmlns="http://schemas.microsoft.com/sharepoint/">

<ContentType
ID="0x010200da5989c5fc2d48bbb0fd4c66cedeea52"


Name="AContentType"


Group="Custom Group"


Description="Custom Content Type"


Version="0">

<FieldRefs>


<FieldRef
ID="{8ea12879-2f2f-4b81-8ae0-9b87b255d3b6}"
Name="AContentTypeField" />

</FieldRefs>

<XmlDocuments>

<XmlDocument
NamespaceURI="http://schemas.microsoft.com/sharepoint/v3/contenttype/forms/url">

<FormUrls
xmlns="http://schemas.microsoft.com/sharepoint/v3/contenttype/forms/url">

<Display>MyCustomForms/DisplayItem.aspx</Display>


<Edit>MyCustomForms/EditItem.aspx</Edit>                  <New>MyCustomForms/NewItem.aspx</New>

</FormUrls>

</XmlDocument>

</XmlDocuments>

</ContentType>



<Field
ID="{8ea12879-2f2f-4b81-8ae0-9b87b255d3b6}"


Type="Text"


Name="AContentTypeField"


DisplayName="AContentType Field"


StaticName="AContentTypeField"


Hidden="FALSE"


Required="FALSE"


Sealed="FALSE" />

</Elements>

Related: Define Custom Forms for your Custom Content Type

No comments:

Post a Comment