public static void AddWorklfowTemplate() { try { bool exists = false; SPSolutionCollection solutionCollection = SPFarm.Local.Solutions; foreach (SPSolution sol in solutionCollection) { if (sol.Name.ToLower() == "spdg workflow.wsp") { exists = true; break; } } if (!exists) { SPSolution solution = SPFarm.Local.Solutions.Add("SampleData\\SPDG Workflow.wsp"); solution.DeployLocal(true, true); } } catch (Exception ex) { Errors.Log(ex); } }
private void FillList() { SolutionsList.Items.Clear(); farm = SPFarm.Local; SPSolutionCollection output = (SPSolutionCollection)spHandler.GetListOfSolutions(); foreach (var item in output) { ListViewItem lvItem = new ListViewItem(new string[] { item.Name, item.Id.ToString(), item.Deployed.ToString(), }); SolutionsList.Items.Add(lvItem); } }
public override bool IsSolutionInstalled(StorePackage package, SPWeb targetWeb) { bool isInstalled = false; if (package.SolutionType == SolutionType.Farm) { SPSolutionCollection allSolutions = SPFarm.Local.Solutions; foreach (var solution in allSolutions) { if (!isInstalled) { if (solution.SolutionFile.Name.IndexOf(package.SolutionFileName, StringComparison.InvariantCultureIgnoreCase) >= 0) { isInstalled = true; } } } } return(isInstalled); }
private XmlNode GetFarmSolutionsNode(SPSolutionCollection farmSolutions) { XmlNode farmSolutionsNode = FarmXml.CreateElement("FarmSolutions"); XmlNode countAttribute = FarmXml.CreateAttribute("Count"); countAttribute.Value = farmSolutions.Count.ToString(); farmSolutionsNode.Attributes.SetNamedItem(countAttribute); foreach (SPSolution solution in farmSolutions) { XmlNode solutionNode = FarmXml.CreateElement("Solution"); List <AttributeValuePair> solutionAttributes = SPAttributes.GetSPSolutionAttributes(solution); foreach (AttributeValuePair solutionAttribute in solutionAttributes) { solutionNode.Attributes.SetNamedItem(GetXmlAttribute(solutionAttribute)); } try { solutionNode.AppendChild(GetServersNode(solution.DeployedServers, "DeployedServers")); } catch (Exception e) { solutionNode.Attributes.SetNamedItem(GetXmlAttribute(new AttributeValuePair("Exception", e.ToString()))); } try { solutionNode.AppendChild(GetWebApplicationsNode(solution.DeployedWebApplications, "DeployedWebApplications")); } catch (Exception e) { solutionNode.Attributes.SetNamedItem(GetXmlAttribute(new AttributeValuePair("Exception", e.ToString()))); } farmSolutionsNode.AppendChild(solutionNode); } return(farmSolutionsNode); }
private SPSolution GetSolutionById(string ID) { SPSolutionCollection output = (SPSolutionCollection)spHandler.GetListOfSolutions(); return(output.Where(x => x.Id == new Guid(ID)).Single()); }