0
votes

I want to connect to the document library built in web part in SharePoint online and programmatically change the document library name from another web part. is There anyway to do that? web part

2

2 Answers

0
votes

You cannot rename the built-in web parts, if this is what you mean.

0
votes

@Mahmoud Samy,

I understand you're developing a custom SPFx web part. In this webpart you want to change the embed library in a built-in document library webpart in a modern page. If so, you could have a try PnPjs:

 // use from the sp.web fluent chain
  const page = await sp.web.loadClientsidePage("/sites/tcccc/SitePages/ssssss.aspx");
  let control = page.findControl(c => c['title'] == 'Document library') as ClientsideWebpart; 
  control.setProperties(
    {
      hideCommandBar: true,
      isDocumentLibrary: true,
      selectedListId: "bb30a1a4-c5fd-4cc5-a8cc-b3c0163f5555",
      selectedListUrl: "/sites/tcccc/SiteAssets",
      selectedViewId: "1419b89f-e56f-4337-9028-3f33560c59fc",
      webRelativeListUrl: "/SiteAssets"
    }
  );

  control.data.webPartData.serverProcessedContent.searchablePlainTexts= {listTitle: "Site Assets"};       
  page.save();

More reference: