Saturday, October 4, 2008

SharePoint Element.xml examples

Element.xml:

<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">

<Field ID="NewGUID(with Braces)" Type="Text" DisplayName="NewColumnName" Name="NewColumnName" Description="This is new column" Group="SharePoint Training" Indexed="TRUE" Required="TRUE" Sealed="TRUE"></Field>

<ContentType ID="0x01NewGuidwithBracesAnd(-)"
Name="New Content Type"
Description="This is a new content type" Group="SharePoint Training" >
<FieldRefs>
<FieldRef ID="GUIDForTheFieldCreatedAbove(with Braces)" Name="NewColumnName" />
<RemoveFieldRef ID="{fa564e0f-0c70-4ab9-b863-0177e6ddd247}" Name="Title"/>
</FieldRefs>
<XmlDocuments>
<XmlDocument NamespaceURI="http://schemas.microsoft.com/sharepoint/events">
<spe:Receivers xmlns:spe="http://schemas.microsoft.com/sharepoint/events">
<spe:Receiver>
<spe:Name>NewContentTypeDeleteHandler</spe:Name>
<spe:Type>ItemDeleting</spe:Type>
<spe:Assembly>AssemblyName, Version=1.0.0.0, Culture=neutral, PublicKeyToken=9f4da00116c38ec5</spe:Assembly>
<spe:Class>NameSpace.NewContentTypeEventHandler</spe:Class>
</spe:Receiver>
</spe:Receivers>
</XmlDocument>

<XmlDocument NamespaceURI="http://schemas.microsoft.com/sharepoint/v3/contenttype/forms">
<FormTemplates xmlns="http://schemas.microsoft.com/sharepoint/v3/contenttype/forms">
<Display>NewContentTypeListForm</Display>
</FormTemplates>
</XmlDocument>
</XmlDocuments>
</ContentType>

<ListInstance FeatureId="GUIDofTheFeatureHavingListTemplateDefinition(withoutBraces)"
Title="New List Display Name" Url="Lists/NewListName">
</ListInstance>

<ContentTypeBinding ContentTypeId="0x01NewGuidwithOutBracesAnd(-)SameAsUsedAbove" ListUrl="Lists/NewListName" />

</Elements>
Article:

0 comments: