SharePoint Tip of the day – Lookup fields defined through xml, WebId and managed paths


Wondering why your lookup field(s) defined through xml are not working anymore when you deploy your solution outside of the root of the web application ? (/sites/whatever or /whatever for the explicit inclusion managed paths) ? Turns out that you need to specify the web id to the tokenized ~sitecollection (and also set overwrite to true if you do have a separate feature for your field and your list schema).

Without this, the lookup field definition which was working flawlessly without any code on the root of the web application was unable to find back its associated list.

That webid attribute, awfully unproperly documented within msdn / sdk, also allows you to define the guid of the target web holding the list instance.