Introduction
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:
1 |
|
But, bad news here, this code is expecting something like List/ListName
and it doesn’t works for a Libraries. Unless you put there directly the Library ID
(http://www.sharepointnutsandbolts.com/2007/04/creating-list-based-site-columns-as.html).
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