I would like to use c# to remotely deploy my sharepoint site collections and sites, I can easily write the code to perform most operations.
However I can't seem to find a way of deploying the code to sitecollection level rather than farm level.
Leaving my laptop at work I don't have the exact code but it goes like this so far ->
Create sitecollection add a sitecollection (http://server/managed-wildcard-path/sitecollection-name to it open up the solution DeployLocal to sitecollection.
The solution is found and DeployLocal runs without errors, however the solution isn't deployed not even on the route.
Does anyone know how to go about this? If I have the right idea but possibly the wrong idea of how it works, please also inform me.
[update]
Here is the code:
try
{
// Attempt to add the solution to the solution store
SPSolution solution = new SPSolution();
solution = SPFarm.Local.Solutions.Add(wspUrl);
}
catch (Exception ex)
{
OutPutMessage("--------------------\r\n" + wspUrl + ": This solution already exists in the solution store");
}
finally
{
// Create a new sitecollection collection and add the target site too it
Collection<SPWebApplication> webapps = new Collection<SPWebApplication>();
SPWebApplication webapp = SPWebApplication.Lookup(new Uri(siteUrl));
webapps.Add(webapp);
// Open the target wsp
SPSolution solutionToDeploy = new SPSolution();
txtConsole.Text += "Solution name: \"" + SPFarm.Local.Solutions[strSolutionName].DisplayName + "\"\r\n";
solutionToDeploy = SPFarm.Local.Solutions[strSolutionName];
// and deploy
solutionToDeploy.DeployLocal(true, webapps, true);
OutPutMessage("----------------\r\nSolution Deployed\r\n----------------";
}