I'm using this xml in order to declare a lookup column :

<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">  
   DisplayName="From Duration"
   Group="Leave Request App Group">

Even though it is declared ok , i don't get any values in the lookup field.

Any ideas what i'm doing wrong?

  • Is your DurationSettings List contains list items ? Sep 14, 2017 at 9:36
  • Yes it does . I have list items with Fields : Title (the default one) and Hours . So it has two fields. The list items are added through the SharePoint add-in hardcoded but i also tried to add some manually . The lookup fields won't read them. I think something is wrong with the mapping of the lookup field and the title field
    – shak
    Sep 14, 2017 at 11:54

2 Answers 2

<Field ID="{8b26ec41-b6c3-4327-0066-0c18c0768626}" Name="InternalName" StaticName="InternalName" DisplayName="Display Name" Type="Lookup" ShowField="Title" Mult="TRUE" List="Lists/LookupList" Overwrite="TRUE" />

Useful links Check this once.

Link 1

Link 2

  • May b this link will useful to create lookup column in SharePoint Apps using XML.
    – san
    Sep 14, 2017 at 9:05
  • Thanks for the help but i still don't understand. I create Site Columns , i add them to the Site Content Types and then add the Content Type to the list. I added the column "From Duration" into the Contenty Type and then into the list. Do i need to write code to add this field? For standard fields all i do is create them and add them to Site Content type. Now i need to add the lookup field programmatically by using clientContext?
    – shak
    Sep 14, 2017 at 11:52
  • No need to write code. You just open default.xml file and add the lookup field. Note the lookup to the list which is accomplished purely with declarative XML courtesy of the “List="Lists/DurationSettings" Check this link
    – san
    Sep 15, 2017 at 2:38
  • Still doesn't work. Are you sure this works? Have you tested it ? Don't know why it doesn't work. Its a simple lookup field
    – shak
    Sep 18, 2017 at 10:05

The solution is to give priority to the feature which deploys the list that you want to lookup for (the source list). You can do that by changing the feature activation order in the Package manifest.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.