public static ConfigurationPackageHandler GetConfigurationPackageHandlerForSandbox() { Assembly sbAssembly = Assembly.Load(Utilities.SandBoxSolutionAssemblyName); ConfigurationPackageHandler handler = (ConfigurationPackageHandler)sbAssembly.CreateInstance("SPSIN.SandboxConfigurationPackageHandler"); return(handler); }
internal static List <SPFeatureDefinition> GetAllConfigurationPackages(SPContext context) { List <SPFeatureDefinition> featureDefinitions = new List <SPFeatureDefinition>(); List <SPFeatureDefinition> allFeatures = new List <SPFeatureDefinition>(); if (SPFarm.Local.BuildVersion > new Version("14.0.0.0")) { //Load handler for sandbox solutions try { ConfigurationPackageHandler handler = GetConfigurationPackageHandlerForSandbox(); allFeatures = handler.GetConfigurationPackages(context); } catch { } } SPFeatureDefinitionCollection farmFeatures = SPFarm.Local.FeatureDefinitions; foreach (SPFeatureDefinition farmFeature in farmFeatures) { allFeatures.Add(farmFeature); } foreach (SPFeatureDefinition feature in allFeatures) { if (feature.Properties["SPSIN_ConfigPackage_Title"] != null && !string.IsNullOrEmpty(feature.Properties["SPSIN_ConfigPackage_Title"].Value)) { featureDefinitions.Add(feature); } } return(featureDefinitions); }