SharePoint 2010 : Erreur « A duplicate name [...] was found » sur un Document Set

Avec CKS, l’import d’un Document Set existant présente un bug qui fait que le namespace « http://schemas.microsoft.com/sharepoint/v3/contenttype/forms » est définit à plusieurs reprises et au même niveau ; soit dans le cas présent au niveau des nœuds « XmlDocument »

Exemple :

<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
	<!-- Parent ContentType: Document Set (0x0120D520) -->
	<ContentType ID="0x0120D520006071f30cfa0341a3ac5ce3b77de0d74c"
	             Name="CT_ProductsDocumentSet"
	             Group="My custom group"
	             Description="My Content Type"
	             Inherits="FALSE"
	             Version="0">
		<FieldRefs>
			<FieldRef ID="{341D312F-13AC-48E8-9363-4CBC63C2B48F}" Name=" Products" />
		</FieldRefs>
		<XmlDocuments>
			<XmlDocument NamespaceURI="http://schemas.microsoft.com/sharepoint/v3/contenttype/forms">
				<spe:Receivers xmlns:spe="http://schemas.microsoft.com/sharepoint/events">
					<Receiver>
						<Name>DocumentSet ItemUpdated</Name>
						<Synchronization>Synchronous</Synchronization>
						<Type>10002</Type>
						<SequenceNumber>100</SequenceNumber>
						<Assembly>Microsoft.Office.DocumentManagement, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c</Assembly>
						<Class>Microsoft.Office.DocumentManagement.DocumentSets.DocumentSetEventReceiver</Class>
						<Data></Data>
						<Filter></Filter>
					</Receiver>
					<Receiver>
						<Name>DocumentSet ItemAdded</Name>
						<Synchronization>Synchronous</Synchronization>
						<Type>10001</Type>
						<SequenceNumber>100</SequenceNumber>
						<Assembly>Microsoft.Office.DocumentManagement, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c</Assembly>
						<Class>Microsoft.Office.DocumentManagement.DocumentSets.DocumentSetItemsEventReceiver</Class>
						<Data></Data>
						<Filter></Filter>
					</Receiver>
				</spe:Receivers>
			</XmlDocument>
			<XmlDocument NamespaceURI="http://schemas.microsoft.com/sharepoint/v3/contenttype/forms">
				<act:AllowedContentTypes xmlns:act="http://schemas.microsoft.com/office/documentsets/allowedcontenttypes">
					<AllowedContentType id="0x0101" />
					<AllowedContentType id="0x0101004203586CBFE647AF924A6B097C2058F9" />
					<AllowedContentType id="0x0101004203586CBFE647AF924A6B097C2058F9008DF4F7EF1776402FB27DEF8E34F9373D" />
				</act:AllowedContentTypes>
			</XmlDocument>
			<XmlDocument NamespaceURI="http://schemas.microsoft.com/sharepoint/v3/contenttype/forms">
				<sf:SharedFields xmlns:sf="http://schemas.microsoft.com/office/documentsets/sharedfields">
					<SharedField id="341D312F-13AC-48E8-9363-4CBC63C2B48F" />
				</sf:SharedFields>
			</XmlDocument>
			<XmlDocument NamespaceURI="http://schemas.microsoft.com/sharepoint/v3/contenttype/forms">
				<wpf:WelcomePageFields xmlns:wpf="http://schemas.microsoft.com/office/documentsets/welcomepagefields">
					<WelcomePageField ID="341D312F-13AC-48E8-9363-4CBC63C2B48F" />
				</wpf:WelcomePageFields>
			</XmlDocument>
		</XmlDocuments>
	</ContentType>
</Elements>

La solution consiste donc à rendre ce namespace unique au niveau des nœuds « XmlDocument ». Dans l’exemple ci-dessous, le namespace du nœud enfant a été repris à chaque fois.

<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
	<!-- Parent ContentType: Document Set (0x0120D520) -->
	<ContentType ID="0x0120D520006071f30cfa0341a3ac5ce3b77de0d74c"
	             Name="CT_ProductsDocumentSet"
	             Group="My custom group"
	             Description="My Content Type"
	             Inherits="FALSE"
	             Version="0">
		<FieldRefs>
			<FieldRef ID="{341D312F-13AC-48E8-9363-4CBC63C2B48F}" Name=" Products" />
		</FieldRefs>
		<XmlDocuments>
			<XmlDocument NamespaceURI="http://schemas.microsoft.com/sharepoint/events">
				<spe:Receivers xmlns:spe="http://schemas.microsoft.com/sharepoint/events">
					<Receiver>
						<Name>DocumentSet ItemUpdated</Name>
						<Synchronization>Synchronous</Synchronization>
						<Type>10002</Type>
						<SequenceNumber>100</SequenceNumber>
						<Assembly>Microsoft.Office.DocumentManagement, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c</Assembly>
						<Class>Microsoft.Office.DocumentManagement.DocumentSets.DocumentSetEventReceiver</Class>
						<Data></Data>
						<Filter></Filter>
					</Receiver>
					<Receiver>
						<Name>DocumentSet ItemAdded</Name>
						<Synchronization>Synchronous</Synchronization>
						<Type>10001</Type>
						<SequenceNumber>100</SequenceNumber>
						<Assembly>Microsoft.Office.DocumentManagement, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c</Assembly>
						<Class>Microsoft.Office.DocumentManagement.DocumentSets.DocumentSetItemsEventReceiver</Class>
						<Data></Data>
						<Filter></Filter>
					</Receiver>
				</spe:Receivers>
			</XmlDocument>
			<XmlDocument NamespaceURI="http://schemas.microsoft.com/office/documentsets/allowedcontenttypes">
				<act:AllowedContentTypes xmlns:act="http://schemas.microsoft.com/office/documentsets/allowedcontenttypes">
					<AllowedContentType id="0x0101" />
					<AllowedContentType id="0x0101004203586CBFE647AF924A6B097C2058F9" />
					<AllowedContentType id="0x0101004203586CBFE647AF924A6B097C2058F9008DF4F7EF1776402FB27DEF8E34F9373D" />
				</act:AllowedContentTypes>
			</XmlDocument>
			<XmlDocument NamespaceURI="http://schemas.microsoft.com/office/documentsets/sharedfields">
				<sf:SharedFields xmlns:sf="http://schemas.microsoft.com/office/documentsets/sharedfields">
					<SharedField id="341D312F-13AC-48E8-9363-4CBC63C2B48F" />
				</sf:SharedFields>
			</XmlDocument>
			<XmlDocument NamespaceURI="http://schemas.microsoft.com/office/documentsets/welcomepagefields">
				<wpf:WelcomePageFields xmlns:wpf="http://schemas.microsoft.com/office/documentsets/welcomepagefields">
					<WelcomePageField ID="341D312F-13AC-48E8-9363-4CBC63C2B48F" />
				</wpf:WelcomePageFields>
			</XmlDocument>
		</XmlDocuments>
	</ContentType>
</Elements>

Laisser un commentaire

Votre adresse de messagerie ne sera pas publiée. Les champs obligatoires sont indiqués avec *

*

Vous pouvez utiliser ces balises et attributs HTML : <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>