Wiggy Thoughts

Sunday, June 21, 2009

Provision lookup field using only the list schema

Defining a lookup field on a list schema seems to be a simple task… but as almost everything that looks simple, it turns out not so simple.

My first approach was to simply include this in my list schema:

<Field ID="{52C2BFC2-268B-4bc8-9D6D-A7BEDEFDFA8C}" Type="Lookup" Name="QuestionCategory"
DisplayName="Category" List="{a8c71795-34a4-41e2-b15e-72a3620a1887}" ShowField="CategoryName" />


And it didn’t worked. First thought was to create a feature receiver that would handle the lookup field provision. But after a few minutes googling about the problem i found that apparently de List attribute should be set to the lookup list relative path. So, this one just works:



<Field ID="{52C2BFC2-268B-4bc8-9D6D-A7BEDEFDFA8C}" Type="Lookup" Name="QuestionCategory"
DisplayName="Categoria" List="$Resources:core,lists_Folder;/Categories" ShowField="CategoryName" />

Labels:

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]



<< Home