When we need to provision a new lookup column referencing a Library we can thing about using XML procedure that means using a code similar to this one:
I am pretty sure, we don’t know the exact GUID of the referred library, in my case it is Pages Library, so, this way doesn’t works for my scenario. Even if I change $Resources:osrvcore,List_Pages_UrlName; by Pages or by /Pages. It doesn’t works.
JSOM to rescue
Luckily, we have JSOM library that sometimes is helping us in the provisioning process.
You can use this code to create a new lookup to Pages Library in the Documents Library.
Code
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters