문제

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.

도움이 되었습니까?

해결책

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:

PnP JS - Fields.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 sharepoint.stackexchange
scroll top