SharePoint, Office 365, Azure, and Front end JS geek. – Chicago IL
SharePoint, Office 365, Azure, and Front end JS geek. – Chicago IL

Reduce SPPKG WebParts Features with Powershell

The below steps will reduce a SPPKG to only select Features and WebParts we want to keep.  Every SPPKG file is actually a ZIP with XML manifest and subfolder for each WebPart and Feature.  Extracting the SPPKG as ZIP allows us to review the internal content, enumerate all Features, and then select ones to keep in a final compressed ZIP file (SPPKG file).

If you want to upload only a few WebParts from a SPPKG package to Office 365’s App Catalog then check out the video below.

Cheers!  

shades_smile

Video

Code

Screenshots

image
image
image

References

  • Jassim Khan

    Hi Jeff,
    Thanks for the amazing work. I was able to extract one web part and make sppkg as you have described in the video, but when I upload the package to my App Catalog in SharePoint online (O365) it shows the following error in the ‘App Package Error Message’ column

    Error Message: “The package contains the wrong number of relationships for relationship type ‘Expected: 1, Actual:0’ ”

    Thoughts?

    P:S: I had SPFx 40 fantastic web part package deployed in App Catalog which I removed to avoid any conflicts with the new package file.

    • I get the same error message and am troubleshooting. Might be related to _rels subfolder.

      Was this in Office 365 SharePoint Online – or SharePoint on-premise? ULS logs in on-premise might show the XML file and line number raising the error.

      • Jassim Khan

        It was in SharePoint online – Office 365. I am not sure if it will work on SharePoint on-prem because it was developed on the older version.

  • Prema Arya

    I tried the script noticed the .xml.config file for the feature was not getting copied ..after including the file also getting same error. I am using SharePoint online.

© Copyright 2016
@ SPJeff

Return to Top ▲Return to Top ▲