2010-06-30 3 views
0

필자는 Elements.xml에 정의 된 컨텐트 유형이 있으며 이벤트 수신기를 추가하려고합니다. 내 Elements.xml은 다음과 같습니다.콘텐츠 형식에서 XmlDocuments 요소가 무시됩니까?

<?xml version="1.0" encoding="utf-8"?> 
<Elements xmlns="http://schemas.microsoft.com/sharepoint/"> 
    <!-- Parent ContentType: Announcement (0x0104) --> 
    <ContentType ID="0x0104008a424de98660457481eb7d8ddb5161ee" 
       Name="News Posting" 
       Group="News" 
       Description="$Resources:NewsCTypeDescription" 
       Inherits="TRUE" 
       Version="1" 
       Sealed="TRUE" 
       > 
    <FieldRefs> 
     <FieldRef ID="{7EBC5918-CB79-440A-8DF3-480C6951C4EB}" Name="NewsExcerpt"/> 
    </FieldRefs> 
    <XmlDocuments> 
     <XmlDocument NamespaceURI="http://schemas.microsoft.com/sharepoint/events"> 
     <spe:Receivers xmlns:spe="http://schemas.microsoft.com/sharepoint/events"> 
      <Receiver> 
      <Name>ItemAdded</Name> 
      <Type>ItemAdded</Type> 
      <Class>MyAssembly.NewsItemEventReceiver</Class> 
      <Assembly>$SharePoint.Project.AssemblyFullName$</Assembly> 
      <SequenceNumber>10000</SequenceNumber> 
      <Synchronization>Synchronous</Synchronization> 
      <Data /> 
      <Filter /> 
      </Receiver> 
     </spe:Receivers> 
     </XmlDocument> 
    </XmlDocuments> 
    </ContentType> 
</Elements> 

이상한 점은 이벤트 수신기가 절대로 실행되지 않는다는 것입니다. SharePoint Manager 2010에서 스키마를 확인한 결과 XmlDocuments 요소가 완전히 무시 된 것 같습니다. 여기 셰어 관리자에 따라 콘텐츠 형식 SchemaXml입니다 :

<?xml version="1.0" encoding="utf-16"?> 
<ContentType ID="0x0104008A424DE98660457481EB7D8DDB5161EE" Name="News Posting" Group="News" Description="A News Posting" Sealed="TRUE" Version="1"> 
    <Folder TargetName="_cts/News Posting" /> 
    <Fields> 
    <Field ID="{c042a256-787d-4a6f-8a8a-cf6ab767f12d}" Name="ContentType" SourceID="http://schemas.microsoft.com/sharepoint/v3" StaticName="ContentType" Group="_Hidden" Type="Computed" DisplayName="Content Type" Sealed="TRUE" Sortable="FALSE" RenderXMLUsingPattern="TRUE" PITarget="MicrosoftWindowsSharePointServices" PIAttribute="ContentTypeID" Customization=""> 
     <FieldRefs> 
     <FieldRef ID="{03e45e84-1992-4d42-9116-26f756012634}" Name="ContentTypeId" /> 
     </FieldRefs> 
     <DisplayPattern> 
     <MapToContentType> 
      <Column Name="ContentTypeId" /> 
     </MapToContentType> 
     </DisplayPattern> 
    </Field> 
    <Field ID="{fa564e0f-0c70-4ab9-b863-0177e6ddd247}" Name="Title" SourceID="http://schemas.microsoft.com/sharepoint/v3" StaticName="Title" Group="_Hidden" Type="Text" DisplayName="Title" Required="TRUE" FromBaseType="TRUE" Customization="" ShowInNewForm="TRUE" ShowInEditForm="TRUE" /> 
    <Field ID="{7662cd2c-f069-4dba-9e35-082cf976e170}" Name="Body" SourceID="http://schemas.microsoft.com/sharepoint/v3" StaticName="Body" Group="_Hidden" Type="Note" RichText="TRUE" RichTextMode="FullHtml" IsolateStyles="TRUE" DisplayName="Body" Sortable="FALSE" NumLines="15" Customization="" /> 
    <Field ID="{6a09e75b-8d17-4698-94a8-371eda1af1ac}" Name="Expires" SourceID="http://schemas.microsoft.com/sharepoint/v3" StaticName="Expires" Group="_Hidden" Type="DateTime" DisplayName="Expires" Format="DateOnly" Customization="" /> 
    <Field ID="{7EBC5918-CB79-440A-8DF3-480C6951C4EB}" Group="News" Name="NewsExcerpt" DisplayName="Excerpt of the Article" Description="165 Characters maximum" MaxLength="165" Type="Text" Customization="" /> 
    </Field> 
    </Fields> 
    <XmlDocuments> 
    <XmlDocument NamespaceURI="http://schemas.microsoft.com/sharepoint/v3/contenttype/forms"> 
     <FormTemplates xmlns="http://schemas.microsoft.com/sharepoint/v3/contenttype/forms"> 
     <Display>ListForm</Display> 
     <Edit>ListForm</Edit> 
     <New>ListForm</New> 
     </FormTemplates> 
    </XmlDocument> 
    </XmlDocuments> 
</ContentType> 

내가 그 작동하는지 만보고,뿐만 아니라 FormTemplates을 XmlDocument를 추가하는 시도했지만, 심지어 이것은 내가 ListForm2에 ListForm을 변경했습니다 (무시, 하지만 SchemaXml은 변경되지 않습니다.

내가 만들 수있는 전체 웹 응용 프로그램 및 콘텐츠 데이터베이스를 삭제했는지 확인이/오래된 붙어 아무것도 없었다,하지만 결과는 여전히 동일합니다.

이를 XMLDocuments 2010 SharePoint의 감가 상각인가? 대안은 무엇입니까?

+2

다른 사람들은 다음과 같이 짜증납니다. 'Inherits = "FALSE" "이 문제를"고칩니다. 그렇지 않으면, 기능 활성화 수신기 해킹 .. –

답변

0

이벤트 수신기를 기능으로 추가해야합니다. 콘텐츠 유형을 설치하는 동일한 기능의 일부로 사용할 수도 있습니다. 우리는 항상 이런 방식으로 작동하며 완벽하게 작동합니다.

관련 문제