1

I am using SharePoint Framework to provision list and libraries according to the below article:

https://docs.microsoft.com/en-us/sharepoint/dev/spfx/web-parts/get-started/provision-sp-assets-from-package

I was able to deploy lists and libraries using above approach. How do I add lookup field using SharePoint Framework please?

0

you can add the following xml code in elements.xml file in sharepoint/assets folder and replace the properties accordingly

<Field
ID="{6C798145-A205-4FC4-8175-837B0F7744CC}"
Type="Lookup"
DisplayName="Colors"
Required="false"
List="F7CD8F64-A506-4FB5-8A63-B9268CD7D1E4"
ShowField="Color"
UnlimitedLengthInDocumentLibrary="TRUE"
Group="Test"
StaticName="Colors"
Name="Colors"
Version="1" />
  • I was not able to get GUID as I was provisioning the parent list also. But specified list name using "Lists/<MasterList>". – 404 May 24 '18 at 5:35
  • You are saying instead of GUID, if you specify as Lists/MasterList then it started working? – Mihir Jun 12 '18 at 15:46
  • @404 You are saying instead of GUID, if you specify as Lists/MasterList then it started working? – Joao Paulo Nov 7 '18 at 19:30
0

If list to lookup is created in the same feature as the Field then:

Type="Lookup"

List="Lists/My List"

https://docs.microsoft.com/en-us/sharepoint/dev/schema/field-element-field

List Optional Text. Used to identify the list that is the target of a lookup field (Type="Lookup"). If the target list already exists, the value of the List attribute should be the string representation of the GUID (including braces) that identifies the target list. If the target is the same list as the one that the field belongs to, you can specify "Self". If the target list does not yet exist, the value of the List attribute can be a web-relative URL such as "Lists/My List" but only if the target list is created in the same feature as the one that creates the lookup field. In this case, the value of the List attribute on the Field element must be identical to the value of the Url attribute on the ListInstance element that creates the target list.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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