import { spfi } from "@pnp/sp";
import "@pnp/sp/site-scripts";
const sp = spfi(...);
// Using the absolute URL of the list
const ss = await sp.siteScripts.getSiteScriptFromList("https://TENANT.sharepoint.com/Lists/mylist");
// Using the PnPjs web object to fetch the site script from a specific list
const ss2 = await sp.web.lists.getByTitle("mylist").getSiteScript();
import { spfi } from "@pnp/sp";
import "@pnp/sp/site-scripts";
const extractInfo = {
IncludeBranding: true,
IncludeLinksToExportedItems: true,
IncludeRegionalSettings: true,
IncludeSiteExternalSharingCapability: true,
IncludeTheme: true,
IncludedLists: ["Lists/MyList"]
};
const ss = await sp.siteScripts.getSiteScriptFromWeb("https://TENANT.sharepoint.com/sites/mysite", extractInfo);
// Using the PnPjs web object to fetch the site script from a specific web
const ss2 = await sp.web.getSiteScript(extractInfo);