SharePoint 2013: How to extract all the WSPs in a farm!

A while ago I talked about how to extract all the WSPs in a SharePoint Farm as you can see in this article. After reviewing again this article, I noted that the way I used there to extract the WSPs didn’t work right for SharePoint 2013. Fortunately, I quickly found another approach to extract all the WSPs and this is what I’m sharing tin this article. AS you can see, using the server side API you can easily access to the collection of farm solutions using a SPSolutionCollection object and simply iterate through it in order to save each .WSP.

   1: static void ExtractAllWSPs_2()

   2: { 

   3:     SPFarm spfFarm=SPWebService.ContentService.Farm;

   4:     int iSolutionsNumber = 0;

   5:     SPSolutionCollection spsFarmSolutions=

   6:         spfFarm.Solutions;

   7:     Console.WriteLine("Starting the extraction process...");

   8:     Console.WriteLine("The number of solutions found is {0}",

   9:     spsFarmSolutions.Count);


  11:     foreach (SPSolution spfSolution in spsFarmSolutions)

  12:     {

  13:         Console.WriteLine("Extracting solutiin {0}", spfSolution.DisplayName);

  14:         spfSolution.SolutionFile.SaveAs(spfSolution.DisplayName);

  15:         iSolutionsNumber += 1;

  16:     }

  17:     Console.WriteLine("It has been extracted {0} solutions from the farm", iSolutionsNumber);



  20: }

As a result you will get:

  • On the one hand, you will see all the solutions extracted in the output window.
  • On the other hand, you will have all the solutions physical saved in the server drive.
image_thumb image_thumb[1]



Introduce tus datos o haz clic en un icono para iniciar sesión:

Logo de

Estás comentando usando tu cuenta de Cerrar sesión /  Cambiar )

Google photo

Estás comentando usando tu cuenta de Google. Cerrar sesión /  Cambiar )

Imagen de Twitter

Estás comentando usando tu cuenta de Twitter. Cerrar sesión /  Cambiar )

Foto de Facebook

Estás comentando usando tu cuenta de Facebook. Cerrar sesión /  Cambiar )

Conectando a %s