c# - A dependent lookup field does not support relationships -


during feature activation of sharepoint 2010 project, built , deployed using visual studio 2012, receive error:

a dependent lookup field not support relationships 

i've played around bit sequence in items listed within feature files. of dozen lists definitions i'm installing , instance of each i'm creating, reviewing has been created before error stops activation indicates problem may specific list. list involved in linked-list relation list. depending upon sequence in list instances placed within feature files, related list may or may exist @ time error occurs.

however, lookup field relates lists not created until feature receiver's feature activation code executed. , dependant lookup fields not created until after primary lookup field exists. done via code , none within declarative xml. further, error occurs before feature activated event handler called.

any suggestions on for? ideas might causing error? should other lists well?

in it's declarative xml, suspect list has 1 multiple-lookup field link zero-to-many child elements on linked table. has gone through deployment , activation field, i'd surprised if causing problem - though sharepoint ...

featureactivated event handler:

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 lookup column on recipients list 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 request should delete related recipients             fromrequestfk.indexed = true;             fromrequestfk.update();              // create lookup column on export requests list 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 of suspected problem list:

<?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 marked (eo)" required="false" name="eo documents marked" showinnewform="false" />                     <fieldref id="{279c1c68-616a-4f41-bc90-bf9d0c4d38e7}" displayname="exemption or exception used" required="false" name="exemption or exception 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 marked (ttc)" required="false" name="ttc documents 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 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 marked" displayname="documents 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 used" displayname="exemption or exception 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 marked" displayname="documents 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 marked" />                     <fieldref name="exemption or exception used" />                     <fieldref name="eo export policy acceptance" />                     <fieldref name="eo has approved" />                     <fieldref name="technology transfer controller" />                     <fieldref name="ttc documents 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> 

after messing around lists, commented out line , associated field reference content type elements.xml , list schema.xml files.

<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> 

though presence of multi-valued lookup column did not cause deployment or activation errors, removal fixed activation errors lead question. if still need offending column, i'll add using code within featureactivation event.

i guessing on previous deployments, 2 lists existed , primary lookup field linking them prevented visual studio deleting , recreating lists during deployment. thus, when feature activated, prerequisite objects existed. see other question issues i'm having pre-deployment scripts , why lists not being automatically unlinked: cannot load sharepoint powershell cmdlets in visual studio pre-deployment script


Comments

Popular posts from this blog

php - get table cell data from and place a copy in another table -

javascript - Mootools wait with Fx.Morph start -

php - Navigate throught databse rows -