Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/sharepoint/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jsf-2/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Sharepoint 内容类型中是否忽略了XmlDocuments元素?_Sharepoint_Sharepoint 2010 - Fatal编程技术网

Sharepoint 内容类型中是否忽略了XmlDocuments元素?

Sharepoint 内容类型中是否忽略了XmlDocuments元素?,sharepoint,sharepoint-2010,Sharepoint,Sharepoint 2010,我在Elements.xml中定义了一个内容类型,我想添加一个事件接收器。My Elements.xml如下所示: <?xml version="1.0" encoding="utf-8"?> <Elements xmlns="http://schemas.microsoft.com/sharepoint/"> <!-- Parent ContentType: Announcement (0x0104) --> <ContentType ID="

我在Elements.xml中定义了一个内容类型,我想添加一个事件接收器。My Elements.xml如下所示:

<?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元素被完全忽略了? 以下是SharePoint Manager中的内容类型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,只是想看看它是否有效,但即使忽略了这一点,我也将ListForm更改为ListForm2,但SchemaXml没有更改

我删除了整个Web应用程序和内容数据库,以确保没有过时/卡住的内容,但结果仍然相同


XmlDocuments在SharePoint 2010中是否折旧?有哪些替代方案?

您应该将事件接收器作为功能添加,甚至可以作为安装内容类型的同一功能的一部分。我们总是这样做,对于其他对此感到烦恼的人来说,它非常有效:Inherits=FALSE修复了这个问题;否则,功能激活的接收器黑客。。