0

I am attempting to add a Query String Filter Url Web Part to a page programmatically with JSOM and am hitting a dead end.

I see how you can add a web part if you already have the XML like in this guide: https://docs.microsoft.com/en-us/previous-versions/office/developer/sharepoint-2010/hh185010(v%3Doffice.14)

But how can I get the XML for other OOTB web parts? Thank you so much.

0

We can go to Web Part Gallery(/_catalogs/wp/Forms/AllItems.aspx), find the web part and click "Edit" and click "View Xml" in the ribbon to get the Xml of the web part.

enter image description here

The xml of the query string web part as following.

<?xml version="1.0" encoding="utf-8"?>
<webParts>
  <webPart xmlns="http://schemas.microsoft.com/WebPart/v3">
    <metaData>
      <type name="Microsoft.SharePoint.Portal.WebControls.QueryStringFilterWebPart,Microsoft.Office.Server.FilterControls,Version=15.0.0.0,Culture=neutral,PublicKeyToken=71e9bce111e9429c" />
      <importErrorMessage>$Resources:spscore,DwpBdlCannotImport</importErrorMessage>
    </metaData>
    <data>
      <properties>
        <property name="FilterName" type="string">$Resources:spscore,DwpQueryStringFilterName</property>
        <property name="Title" type="string">$Resources:spscore,DwpQueryStringFilterTitle</property>
        <property name="Description" type="string">$Resources:spscore,DwpQueryStringFilterDescription</property>
        <property name="ChromeType">None</property>
        <property name="CatalogIconImageUrl" type="string">/_layouts/images/wp_Filter.gif</property>
        <property name="TitleIconImageUrl" type="string">/_layouts/images/wp_Filter.gif</property>
      </properties>
    </data>
  </webPart>
</webParts>
  • I appreciate that, but I'm trying to figure out if there is a way to do that with the JSOM or CSOM api – Jonah Kornberg Jan 23 at 18:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.