Pavel2235
Oct 11, 2023Brass Contributor
Add ClientsideWebpart quick links
Hi!
I tried to create a modern page with ClientsideWebparts.
const testPage: IClientsidePage = await sp.web.loadClientsidePage('/SitePages/mypage1.aspx');
const quickLinks = ClientsideWebpart.fromComponentDef((partDefs.filter(c => c.Id === "c70391ea-0b10-4ee9-b2b4-006d3fcad0cd")[0]));
quickLinks.setProperties({
Title: "Google",
iconPicker: "search",
buttonLayoutOptions: {
buttonTreatment: 2,
iconPositionType: 2,
linesOfText: 2,
showDescription: false,
textAlignmentHorizontal: 2,
textAlignmentVertical: 2
},
dataProviderId: "QuickLinks",
serverProcessedContent: {
links: {
baseUrl: "/sites/TestSite",
"items[0].sourceItem.url": "https://xvzms.sharepoint.com/"
}
},
items: [
{
altText: "",
description: "",
id: 1,
sourceItem: {
fileExtension: "",
itemType: 2,
progId: ""
},
thumbnailType: 3
}
]
})
testPage.addSection().addControl(quickLinks);
await testPage.save();
But unfortunately, I don't see any links on the page.
Please tell me what could be the error?
spfx: 1.17.4
pnp sp: 3.18.0