Ahoy mateys! Shiver me timbers, there be a typo here!
I be toiling away on a server side service aimed at crafting a new Sharepoint List Using Graph API. This list be intended for use by humans, so all I need be to create the structure.
Me hearties, when attempting to fashion a simple list with merely text fields, all sails be set fair and true. But now comes the challenge of adding a lookup column to the list. This be a lookout column that ought to refer back to another list in the same site, allowing the scallywags to select one item from the source list.
To be precise, this be the code I be grappling with at present. I have ventured down many other paths I found online, but alas, no treasure to show for it.
const bootyList = {
displayName: `treasurelist`,
columns: [
{ name: "Entity", text: {} },
{ name: "Justification", text: {} },
{ name: "Deescription", text: {} },
{
name: "MacroExpensiveItem",
lookup: {
listId: "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
columnId: "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
},
},
{ name: "Note", text: {} },
],
list: {
template: "genericList",
},
};
const newBootyList = await graph
.api(newListURL)
.version("beta")
.post(bootyList);
For secrecy reasons, I buried the listId and columnId, but rest assured, those ids be correct as Davy Jones' locker in my real code.
Hoist the colors! Executing this code creates the list and sets the column as Lookup, yet the field does not point back to the source list and remains bare as a bone.
Arrr, be it even possible to craft such a lookup field?
I've tried multiple solutions to no avail. I've sailed using only the listId, attempted cloning a base list, and don't even remember how many other maneuvers.