Get List Column configuration using pnp.js
Domanda
I want to fetch the List column configuation to check if a field is required or not.
But I am not able to figure out which function to use by looking at the documentation.
Soluzione
Build your endpoint like given REST endpoint below:
siteUrl/_api/web/lists/getbytitle('ListName')/fields?$select=Title,Required
Something like:
import { sp } from "@pnp/sp";
let web = sp.web;
// get the fields in a list
web.lists.getByTitle("MyList").fields.get().then(f => {
console.log("Field: " + f.Title);
console.log("Required: " + f.Required);
});
Reference:
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a sharepoint.stackexchange