从属查找字段不支持关系

时间:2013-07-25 15:55:37

标签: c# xml visual-studio-2012 sharepoint-2010 feature-activation

在使用Visual Studio 2012构建和部署的SharePoint 2010项目的功能激活期间,我收到此错误:

A dependent lookup field does not support relationships

我在我的功能文件中列出了项目的顺序。在我正在安装的十几个列表定义和我正在创建的每个实例中,查看错误停止激活之前实际创建的内容表明问题可能出在特定列表中。该列表将涉及与另一个列表的链表关系。根据列表实例在要素文件中的放置顺序,相关列表可能会或可能在错误发生时存在。

但是,在执行功能接收器的功能激活代码之前,不会创建与列表相关的查找字段。并且在主查找字段存在之后才会创建从属查找字段。所有都是通过代码完成的,并且在声明性XML中没有。此外,错误发生在调用功能激活事件处理程序之前。

有关寻找什么的任何建议? 可能导致此错误的任何想法? 我应该查看其他列表吗?

在它的声明性XML中,可疑列表有一个多重查找字段,用于链接表上的零对多子元素。它之前已经通过这个领域进行了部署和激活,所以如果它现在导致问题我会感到惊讶 - 尽管使用SharePoint ......

FeatureActivated事件处理程序:

public override void FeatureActivated(SPFeatureReceiverProperties properties)
{
    SPSite site = (SPSite)properties.Feature.Parent;
    using (SPWeb web = site.OpenWeb())
    {
        web.AllowUnsafeUpdates = true;

        SPList itcoExportRequests = web.Lists["ITCO Export Requests"];
        SPList itcoExportRequestRecipients = web.Lists["ITCO Export Request Recipients"];

        if (itcoExportRequests != null && itcoExportRequestRecipients != null)
        {
            // Create a lookup column on the Recipients list from the Export Requests list
            const string fromRequestFKTitle = "Request ID";
            string fromRequestFKInternalName = SPEncodeName(fromRequestFKTitle);

            if (!itcoExportRequestRecipients.Fields.ContainsField(fromRequestFKTitle))
            {
                fromRequestFKInternalName = itcoExportRequestRecipients.Fields.AddLookup(fromRequestFKTitle, itcoExportRequests.ID, true);
            }

            SPFieldLookup fromRequestFK = (SPFieldLookup)itcoExportRequestRecipients.Fields.GetFieldByInternalName(fromRequestFKInternalName);
            fromRequestFK.LookupField = itcoExportRequests.Fields["ID"].InternalName;
            fromRequestFK.IsRelationship = true;
            fromRequestFK.RelationshipDeleteBehavior = SPRelationshipDeleteBehavior.Cascade;  // Deleting a request should delete related recipients
            fromRequestFK.Indexed = true;
            fromRequestFK.Update();

            // Create a lookup column on the Export Requests list from the Recipients list
            const string fromRecipientsFKTitle = "Recipient IDs";
            string fromRecipientsFKInternalName = SPEncodeName(fromRecipientsFKTitle);

            if (!itcoExportRequests.Fields.ContainsField(fromRecipientsFKTitle))
            {
                fromRecipientsFKInternalName = itcoExportRequests.Fields.AddLookup(fromRecipientsFKTitle, itcoExportRequests.ID, false);
            }

            SPFieldLookup fromRecipientsFK = (SPFieldLookup)itcoExportRequests.Fields.GetFieldByInternalName(fromRecipientsFKInternalName);
            fromRecipientsFK.LookupField = itcoExportRequestRecipients.Fields["ID"].InternalName;
            fromRecipientsFK.AllowMultipleValues = true;
            fromRecipientsFK.Indexed = false;
            fromRecipientsFK.RelationshipDeleteBehavior = SPRelationshipDeleteBehavior.None;
            fromRecipientsFK.Update();

            // dependant lookup columns
            const string fromRecipientRecipientTitle = "Recipient";
            string fromRecipientRecipientInternalName = SPEncodeName(fromRecipientRecipientTitle);
            if (!itcoExportRequests.Fields.ContainsField(fromRecipientRecipientTitle))
            {
                fromRecipientRecipientInternalName = itcoExportRequests.Fields.AddDependentLookup(fromRecipientRecipientTitle, fromRecipientsFK.Id);
            }

            const string fromRecipientCountryTitle = "Recipient Country";
            string fromRecipientCountryInternalName = SPEncodeName(fromRecipientCountryTitle);
            if (!itcoExportRequests.Fields.ContainsField(fromRecipientCountryTitle))
            {
                fromRecipientCountryInternalName = itcoExportRequests.Fields.AddDependentLookup(fromRecipientCountryTitle, fromRecipientsFK.Id);
            }

            const string fromRecipientAddressTitle = "Recipient Address";
            string fromRecipientAddressInternalName = SPEncodeName(fromRecipientAddressTitle);
            if (!itcoExportRequests.Fields.ContainsField(fromRecipientAddressTitle))
            {
                fromRecipientAddressInternalName = itcoExportRequests.Fields.AddDependentLookup(fromRecipientAddressTitle, fromRecipientsFK.Id);
            }
        }

        EnsureWorkflowAssociation(web);
        LoadPropertyBag(web);

        #region Event Receivers

        SPList taskList = web.Lists["Tasks"];
        //taskList.EventReceivers.Add(SPEventReceiverType.ItemAdded, Assembly.GetExecutingAssembly().FullName, "LMENT.MFC.ITCO.WorkflowTaskEventReceivers.WorkflowTaskEventReceivers");
        //taskList.EventReceivers.Add(SPEventReceiverType.ItemUpdated, Assembly.GetExecutingAssembly().FullName, "LMENT.MFC.ITCO.WorkflowTaskEventReceivers.WorkflowTaskEventReceivers");

        #endregion

        web.AllowUnsafeUpdates = false;
    }
}

疑似问题清单的Schema.xml:

<?xml version="1.0" encoding="utf-8"?>
<List xmlns:ows="Microsoft SharePoint" Title="ITCO Export Requests" DisableAttachments="TRUE" FolderCreation="FALSE" Direction="$Resources:Direction;" Url="Lists/ITCO Export Requests" BaseType="0" xmlns="http://schemas.microsoft.com/sharepoint/" EnableContentTypes="TRUE">
    <MetaData>
        <ContentTypes>
            <ContentType ID="0x0100DEF7BC5FF5B44246ABFF4AAE7C751CE8" Name="ITCO Export Request Content Type" Group="ITCO Content Types" Inherits="FALSE" Version="0">
                <FieldRefs>
                    <FieldRef ID="{fd92202e-941d-4358-b511-6b6c5e9451e4}" DisplayName="Request Number" Required="TRUE" Name="Request Number" ReadOnly="TRUE" />
                    <FieldRef ID="{cf4a6b47-a040-4a75-9ce5-60a73cfc8325}" DisplayName="Approval Date" Required="FALSE" Name="Approval Date" ReadOnly="TRUE" ShowInNewForm="FALSE" />
                    <FieldRef ID="{64fd3feb-5460-45f9-a3b2-5564733b2442}" DisplayName="Requestor" Required="TRUE" Name="Requestor" />
                    <FieldRef ID="{674f3ad7-0a8c-47f6-b592-ec213e8405f0}" DisplayName="Request Title" Required="TRUE" Name="Request Title" />
                    <FieldRef ID="{d073bbdb-2735-4993-88cd-2c93d32b4ab5}" DisplayName="Unclassified Acknowledgement" Required="TRUE" Name="Unclassified Acknowledgement" />
                    <FieldRef ID="{63767861-8b11-4644-8fda-1fb044f0d7cf}" DisplayName="ITAR or EAR" Required="TRUE" Name="Request Class" />
                    <FieldRef ID="{325d142d-b100-445e-b4cd-0c639efdcff6}" DisplayName="Export Type" Required="TRUE" Name="Request Type" />
                    <FieldRef ID="{8512dcea-9c59-4a9c-94d7-8fef912b024d}" DisplayName="Document Contains Technical Data" Required="FALSE" Name="Document Contains Technical Data" />
                    <FieldRef ID="{32530a2c-f610-4cce-9265-356074f55bd5}" DisplayName="Export Location" Required="TRUE" Name="Export Location" />
                    <FieldRef ID="{6ae393ef-b628-4b8e-b5c2-e2087816bf4e}" DisplayName="Program" Required="TRUE" Name="Program" />
                    <FieldRef ID="{b8c6f875-e59a-440e-9154-80bc3bfbdc57}" DisplayName="Agreement or License Number" Required="FALSE" Name="Document Number" />
                    <FieldRef ID="{8c19b14d-7cf6-423a-a88d-5b3f17c61375}" DisplayName="Initial Use" Required="FALSE" Name="Initial Use" />
                    <FieldRef ID="{a76a8fb4-3f35-4b81-aab2-92b7bfa2e1e2}" DisplayName="Exemption or Exception Number" Required="FALSE" Name="Exemption or Exception Number" />
                    <FieldRef ID="{984cec2d-b1a6-4a6a-a4c7-fbbf8f30232a}" DisplayName="Authorized Recipients" Required="TRUE" Name="Authorized Recipients" />
                    <FieldRef ID="{b0815589-e18f-46aa-b477-b5eb8da4f0d4}" DisplayName="Authorization Site" Required="FALSE" Name="Authorization Site" />
                    <FieldRef ID="{19595412-14fc-425d-bbea-990b8ad3fa5b}" DisplayName="Method of Transfer" Required="FALSE" Name="Method of Transfer" />
                    <FieldRef ID="{46c596ce-65a6-4b29-9e9f-0ed26f2c9b75}" DisplayName="Export Data Description" Required="FALSE" Name="Export Data Description" />
                    <FieldRef ID="{67df98f4-9dec-48ff-a553-29bece9c5bf4}" DisplayName="$Resources:core,Attachments;" Name="Attachments" />
                    <FieldRef ID="{6DF9BD52-550E-4a30-BC31-A4366832A87E}" DisplayName="Comments" Name="V3Comments" Sortable="FALSE" />
                    <FieldRef ID="{6ca1981d-2398-4440-9e8c-71962aae3dd9}" DisplayName="Export Policy Acceptance (Requestor)" Required="TRUE" Name="Requestor Export Policy Acceptance" />
                    <FieldRef ID="{12ef2114-7428-4834-a38f-5d612c7eecc5}" DisplayName="Empowered Official" Required="TRUE" Name="Empowered Official" />
                    <FieldRef ID="{728219ae-90ee-43b3-a9f1-c5cc53e10e9d}" DisplayName="Documents are Properly Marked (EO)" Required="FALSE" Name="EO Documents are Properly Marked" ShowInNewForm="FALSE" />
                    <FieldRef ID="{279c1c68-616a-4f41-bc90-bf9d0c4d38e7}" DisplayName="Exemption or Exception is Properly Used" Required="FALSE" Name="Exemption or Exception is Properly Used" ShowInNewForm="FALSE" />
                    <FieldRef ID="{61AE5E1D-9A24-4DF3-A394-1A2C83DE4FBD}" DisplayName="Export Policy Acceptance (EO)" Required="TRUE" Name="EO Export Policy Acceptance" ShowInNewForm="FALSE" />
                    <FieldRef ID="{0ea3fd1e-b861-4956-ad23-c65d50af7ec1}" DisplayName="EO has Approved" Required="FALSE" Name="EO has Approved" ShowInNewForm="FALSE" />
                    <FieldRef ID="{5ecaa824-b25e-4195-a42b-b2a3d5fb3c18}" DisplayName="Technology Transfer Controller" Required="TRUE" Name="Technology Transfer Controller" />
                    <FieldRef ID="{06D66AB1-57E4-4843-BC70-67C55E14CD09}" DisplayName="Documents are Properly Marked (TTC)" Required="FALSE" Name="TTC Documents are Properly Marked" ShowInNewForm="FALSE" />
                    <FieldRef ID="{2BF29126-15F9-4058-BA6A-BFC4D9E1BB7C}" DisplayName="Export Policy Acceptance (TTC)" Required="TRUE" Name="TTC Export Policy Acceptance" ShowInNewForm="FALSE" />
                    <FieldRef ID="{8C8C943F-9B84-41E3-A18B-BB849668A800}" DisplayName="TTC has Approved" Required="FALSE" Name="TTC has Approved" ShowInNewForm="FALSE" />
                </FieldRefs>
                <XmlDocuments>
                    <XmlDocument NamespaceURI="http://schemas.microsoft.com/sharepoint/v3/contenttype/forms/url">
                        <FormUrls xmlns:spv3FormUrl="http://schemas.microsoft.com/sharepoint/v3/contenttype/forms/url">
                            <New>_Layouts/$(ProjectName)/ITCO%20Export%20Request%20Form.aspx?mode=new</New>
                            <Edit>_Layouts/$(ProjectName)/ITCO%20Export%20Request%20Form.aspx?mode=edit</Edit>
                            <Display>_Layouts/$(ProjectName)/ITCO%20Export%20Request%20Form.aspx?mode=display</Display>
                        </FormUrls>
                    </XmlDocument>
                </XmlDocuments>
            </ContentType>
        </ContentTypes>
        <Fields>
            <Field ID="{fd92202e-941d-4358-b511-6b6c5e9451e4}" Type="Counter" Name="Request Number" DisplayName="Request Number" Required="TRUE" Group="ITCO Site Columns" AllowDuplicateValues="FALSE" ReadOnly="TRUE" ReadOnlyEnforced="TRUE"></Field>
            <Field ID="{cf4a6b47-a040-4a75-9ce5-60a73cfc8325}" Type="DateTime" Name="Approval Date" DisplayName="Approval Date" Required="FALSE" Group="ITCO Site Columns" ReadOnly="TRUE" ReadOnlyEnforced="TRUE" ShowInNewForm="FALSE" StorageTZ="UTC"></Field>
            <Field ID="{64fd3feb-5460-45f9-a3b2-5564733b2442}" Type="User" Name="Requestor" DisplayName="Requestor" Required="TRUE" Group="ITCO Site Columns" Presence="TRUE" UserSelectionMode="0"></Field>
            <Field ID="{674f3ad7-0a8c-47f6-b592-ec213e8405f0}" Type="Text" Name="Request Title" DisplayName="Request Title" Required="TRUE" Group="ITCO Site Columns"></Field>
            <Field ID="{d073bbdb-2735-4993-88cd-2c93d32b4ab5}" Type="Boolean" Name="Unclassified Acknowledgement" DisplayName="Unclassified Acknowledgement" Required="TRUE" Group="ITCO Site Columns"></Field>
            <Field ID="{63767861-8b11-4644-8fda-1fb044f0d7cf}" Type="Choice" Name="Request Class" DisplayName="ITAR or EAR" Required="TRUE" Group="ITCO Site Columns">
                <CHOICES>
                    <CHOICE>ITAR</CHOICE>
                    <CHOICE>EAR</CHOICE>
                </CHOICES>
            </Field>
            <Field ID="{325d142d-b100-445e-b4cd-0c639efdcff6}" Type="Choice" Name="Request Type" DisplayName="Export Type" Required="TRUE" Group="ITCO Site Columns">
                <CHOICES>
                    <CHOICE>Agreement</CHOICE>
                    <CHOICE>License</CHOICE>
                    <CHOICE>Exemption</CHOICE>
                    <CHOICE>Exception</CHOICE>
                </CHOICES>
            </Field>
            <Field ID="{8512dcea-9c59-4a9c-94d7-8fef912b024d}" Type="Boolean" Name="Document Contains Technical Data" DisplayName="Document Contains Technical Data" Required="FALSE" Group="ITCO Site Columns"></Field>
            <Field ID="{32530a2c-f610-4cce-9265-356074f55bd5}" Name="Export Location" DisplayName="Export Location" Type="Text" Required="TRUE" Group="ITCO Site Columns"></Field>
            <Field ID="{6ae393ef-b628-4b8e-b5c2-e2087816bf4e}" Type="Text" Name="Program" DisplayName="Program" Required="TRUE" Group="ITCO Site Columns"></Field>
            <Field ID="{b8c6f875-e59a-440e-9154-80bc3bfbdc57}" Type="Text" Name="Document Number" DisplayName="Agreement or License Number" Required="FALSE" Group="ITCO Site Columns"></Field>
            <Field ID="{8c19b14d-7cf6-423a-a88d-5b3f17c61375}" Type="Boolean" Name="Initial Use" DisplayName="Initial Use" Required="FALSE" Group="ITCO Site Columns"></Field>
            <Field ID="{a76a8fb4-3f35-4b81-aab2-92b7bfa2e1e2}" Type="Text" Name="Exemption or Exception Number" DisplayName="Exemption or Exception Number" Required="FALSE" Group="ITCO Site Columns"></Field>
            <Field ID="{984cec2d-b1a6-4a6a-a4c7-fbbf8f30232a}" Type="LookupMulti" Name="Authorized Recipients" DisplayName="Authorized Recipients" Required="TRUE" Group="ITCO Site Columns" Mult="TRUE" EnableLookup="TRUE" IsRelationship="TRUE" ShowField="Company" List="Lists/ITCO Export Request Recipients" FieldRef="ID"></Field>
            <Field ID="{b0815589-e18f-46aa-b477-b5eb8da4f0d4}" Type="Text" Name="Authorization Site" DisplayName="Authorization Site" Required="FALSE" Group="ITCO Site Columns" HTMLEncode="TRUE"></Field>
            <Field ID="{19595412-14fc-425d-bbea-990b8ad3fa5b}" Type="Choice" Name="Method of Transfer" DisplayName="Method of Transfer" Required="FALSE" Group="ITCO Site Columns">
                <CHOICES>
                    <CHOICE>Hand Carry</CHOICE>
                    <CHOICE>Meeting</CHOICE>
                    <CHOICE>Mail</CHOICE>
                    <CHOICE>Upload to SharePoint</CHOICE>
                </CHOICES>
            </Field>
            <Field ID="{46c596ce-65a6-4b29-9e9f-0ed26f2c9b75}" Type="Note" Name="Export Data Description" DisplayName="Export Data Description" Required="FALSE" Group="ITCO Site Columns" HTMLEncode="TRUE"></Field>
            <Field ID="{6DF9BD52-550E-4a30-BC31-A4366832A87E}" Type="Note" RichText="TRUE" AppendOnly="TRUE" Name="V3Comments" DisplayName="Comments" Sortable="FALSE" SourceID="http://schemas.microsoft.com/sharepoint/v3" StaticName="V3Comments" Group="$Resources:core,Base_Columns;" />
            <Field ID="{6ca1981d-2398-4440-9e8c-71962aae3dd9}" Type="Text" Name="Requestor Export Policy Acceptance" DisplayName="Export Policy Acceptance (Requestor)" Required="TRUE" Group="ITCO Site Columns"></Field>
            <Field ID="{12ef2114-7428-4834-a38f-5d612c7eecc5}" Name="Empowered Official" DisplayName="Empowered Official" Type="User" Required="TRUE" Group="ITCO Site Columns" Presence="TRUE" UserSelectionMode="0"></Field>
            <Field ID="{728219ae-90ee-43b3-a9f1-c5cc53e10e9d}" Type="Choice" Name="EO Documents are Properly Marked" DisplayName="Documents are Properly Marked (EO)" Required="FALSE" Group="ITCO Site Columns" ShowInNewForm="FALSE">
                <CHOICES>
                    <CHOICE>Yes</CHOICE>
                    <CHOICE>No</CHOICE>
                    <CHOICE>No Attachment</CHOICE>
                </CHOICES>
            </Field>
            <Field ID="{279c1c68-616a-4f41-bc90-bf9d0c4d38e7}" Type="Boolean" Name="Exemption or Exception is Properly Used" DisplayName="Exemption or Exception is Properly Used" Required="FALSE" Group="ITCO Site Columns" ShowInNewForm="FALSE"></Field>
            <Field ID="{61AE5E1D-9A24-4DF3-A394-1A2C83DE4FBD}" Type="Text" Name="EO Export Policy Acceptance" DisplayName="Export Policy Acceptance (EO)" Required="TRUE" Group="ITCO Site Columns" ShowInNewForm="FALSE"></Field>
            <Field ID="{0ea3fd1e-b861-4956-ad23-c65d50af7ec1}" Type="Boolean" Name="EO has Approved" DisplayName="EO has Approved" Required="FALSE" Group="ITCO Site Columns" ShowInNewForm="FALSE"></Field>
            <Field ID="{5ecaa824-b25e-4195-a42b-b2a3d5fb3c18}" Type="User" Name="Technology Transfer Controller" DisplayName="Technology Transfer Controller" Required="TRUE" Group="ITCO Site Columns" Presence="TRUE" UserSelectionMode="0"></Field>
            <Field ID="{06D66AB1-57E4-4843-BC70-67C55E14CD09}" Type="Boolean" Name="TTC Documents are Properly Marked" DisplayName="Documents are Properly Marked (TTC)" Required="FALSE" Group="ITCO Site Columns" ShowInNewForm="FALSE">
                <CHOICES>
                    <CHOICE>Yes</CHOICE>
                    <CHOICE>No</CHOICE>
                    <CHOICE>No Attachment</CHOICE>
                </CHOICES>
            </Field>
            <Field ID="{2BF29126-15F9-4058-BA6A-BFC4D9E1BB7C}" Type="Text" Name="TTC Export Policy Acceptance" DisplayName="Export Policy Acceptance (TTC)" Required="TRUE" Group="ITCO Site Columns" ShowInNewForm="FALSE"></Field>
            <Field ID="{8C8C943F-9B84-41E3-A18B-BB849668A800}" Type="Boolean" Name="TTC has Approved" DisplayName="TTC has Approved" Required="FALSE" Group="ITCO Site Columns" ShowInNewForm="FALSE"></Field>
        </Fields>
        <Views>
            <View BaseViewID="0" Type="HTML" MobileView="TRUE" TabularView="FALSE">
                <Toolbar Type="Standard" />
                <XslLink Default="TRUE">main.xsl</XslLink>
                <RowLimit Paged="TRUE">30</RowLimit>
                <ViewFields>
                    <FieldRef Name="LinkTitleNoMenu"></FieldRef>
                </ViewFields>
                <Query>
                    <OrderBy>
                        <FieldRef Name="Modified" Ascending="FALSE"></FieldRef>
                    </OrderBy>
                </Query>
                <ParameterBindings>
                    <ParameterBinding Name="AddNewAnnouncement" Location="Resource(wss,addnewitem)" />
                    <ParameterBinding Name="NoAnnouncements" Location="Resource(wss,noXinviewofY_LIST)" />
                    <ParameterBinding Name="NoAnnouncementsHowTo" Location="Resource(wss,noXinviewofY_ONET_HOME)" />
                </ParameterBindings>
            </View>
            <View BaseViewID="1" Type="HTML" WebPartZoneID="Main" DisplayName="$Resources:core,objectiv_schema_mwsidcamlidC24;" DefaultView="TRUE" MobileView="TRUE" MobileDefaultView="TRUE" SetupPath="pages\viewpage.aspx" ImageUrl="/_layouts/images/generic.png" Url="AllItems.aspx">
                <Toolbar Type="Standard" />
                <XslLink Default="TRUE">main.xsl</XslLink>
                <RowLimit Paged="TRUE">30</RowLimit>
                <ViewFields>
                    <FieldRef Name="Attachments"></FieldRef>
                    <FieldRef Name="Request Number" />
                    <FieldRef Name="Approval Date" />
                    <FieldRef Name="Requestor" />
                    <FieldRef Name="Request Title" />
                    <FieldRef Name="Unclassified Acknowledgement" />
                    <FieldRef Name="Request Class" />
                    <FieldRef Name="Request Type" />
                    <FieldRef Name="Document Contains Technical Data" />
                    <FieldRef Name="Export Location" />
                    <FieldRef Name="Program" />
                    <FieldRef Name="Document Number" />
                    <FieldRef Name="Initial Use" />
                    <FieldRef Name="Exemption or Exception Number" />
                    <FieldRef Name="Authorized Recipients" />
                    <FieldRef Name="Authorization Site" />
                    <FieldRef Name="Method of Transfer" />
                    <FieldRef Name="Export Data Description" />
                    <FieldRef Name="V3Comments" />
                    <FieldRef Name="Requestor Export Policy Acceptance" />
                    <FieldRef Name="Empowered Official" />
                    <FieldRef Name="EO Documents are Properly Marked" />
                    <FieldRef Name="Exemption or Exception is Properly Used" />
                    <FieldRef Name="EO Export Policy Acceptance" />
                    <FieldRef Name="EO has Approved" />
                    <FieldRef Name="Technology Transfer Controller" />
                    <FieldRef Name="TTC Documents are Properly Marked" />
                    <FieldRef Name="TTC Export Policy Acceptance" />
                    <FieldRef Name="TTC has Approved" />
                </ViewFields>
                <Query>
                    <OrderBy>
                        <FieldRef Name="ID"></FieldRef>
                    </OrderBy>
                </Query>
                <ParameterBindings>
                    <ParameterBinding Name="NoAnnouncements" Location="Resource(wss,noXinviewofY_LIST)" />
                    <ParameterBinding Name="NoAnnouncementsHowTo" Location="Resource(wss,noXinviewofY_DEFAULT)" />
                </ParameterBindings>
            </View>
        </Views>
        <Forms>
            <Form Type="DisplayForm" Url="DispForm.aspx" SetupPath="pages\form.aspx" WebPartZoneID="Main" />
            <Form Type="EditForm" Url="EditForm.aspx" SetupPath="pages\form.aspx" WebPartZoneID="Main" />
            <Form Type="NewForm" Url="NewForm.aspx" SetupPath="pages\form.aspx" WebPartZoneID="Main" />
        </Forms>
    </MetaData>
</List>

1 个答案:

答案 0 :(得分:0)

在对列表进行一些处理之后,我从内容类型Elements.xml和列表Schema.xml文件中注释掉了这一行和相关的字段引用。

<Field ID="{984cec2d-b1a6-4a6a-a4c7-fbbf8f30232a}" Type="LookupMulti" Name="Authorized Recipients" DisplayName="Authorized Recipients" Required="TRUE" Group="ITCO Site Columns" Mult="TRUE" EnableLookup="TRUE" IsRelationship="TRUE" ShowField="Company" List="Lists/ITCO Export Request Recipients" FieldRef="ID"></Field>

虽然这个多值查找列的存在以前没有导致部署或激活错误,但是它的删除修复了导致我的问题的激活错误。如果我仍然需要违规列,我将使用FeatureActivation事件中的代码添加它。

我猜测在以前的部署中,两个列表已经存在,并且将它们链接在一起的主查找字段阻止了Visual Studio在部署期间删除和重新创建列表。因此,当激活该功能时,所有必备对象都已存在。请参阅我的其他问题,了解我在预部署脚本中遇到的问题以及为什么这些列表没有自动取消链接:Cannot load SharePoint powershell cmdlets in visual studio pre-deployment script