Extract solution file from WSS

I am trying to figure out how to extract a .wsp file of a solution file from a SharePoint server. Is this possible, and if so, how?

+3
source share
2 answers

You can create a small console application and access solutions using the SPFarm.Local.Solutions property. Enable the Microsoft.SharePoint.Administration namespace and use the following code snippet to download the solution file:

SPSolutionCollection solutions = SPFarm.Local.Solutions;

foreach (SPSolution solution in solutions)
{
    SPPersistedFile wspFile = solution.SolutionFile;
    wspFile.SaveAs("c:\\Temp\\Solutions\\" + solution.Name);
}

You need to make sure your output directory exists before calling SaveAs (). If it does not exist, an exception is thrown.

+5
source

, SPFarm. Local. Solutions . , . .

+1

Source: https://habr.com/ru/post/1704318/


All Articles