public static ExternalDefinition Create_SP(string sp_name , ParameterType type, string group_name) { DefinitionFile deFile = CachedApp.OpenSharedParameterFile(); // create new group in the shared paramters files DefinitionGroups groups = deFile.Groups; bool founded = false; Definition myDefinition = groups.First().Definitions.First(); foreach (DefinitionGroup dg in groups) { if (dg.Name == group_name) { ExternalDefinition exDef = dg.Definitions.get_Item(sp_name) as ExternalDefinition; if (exDef != null) { //exDef.Description return(exDef); } //ExternalDefinition exDef = dg.Definitions.get_Item("CompanyName") as ExternalDefinition; ExternalDefinitionCreationOptions option = new ExternalDefinitionCreationOptions(sp_name, type); myDefinition = dg.Definitions.Create(option); founded = true; break; } } if (!founded) { DefinitionGroup myGroup = groups.Create(group_name); // Create a type definition ExternalDefinitionCreationOptions option = new ExternalDefinitionCreationOptions(sp_name, type); myDefinition = myGroup.Definitions.Create(option); } ExternalDefinition eDef = myDefinition as ExternalDefinition; return(eDef); // }