//Gets a SharedParameter private ExternalDefinition GetSharedParameter(Autodesk.Revit.ApplicationServices.Application app, string name) { DefinitionFile defFile = app.OpenSharedParameterFile(); if (defFile == null) { DialogUtils.Failure("Error", $"Shared parameters file does not exist. You are trying to push a Shared Parameter into another Family - make sure you have setup a Shared Parameters file."); return(null); //throw new Exception("No SharedParameter File!"); } var v = (from DefinitionGroup dg in defFile.Groups from ExternalDefinition d in dg.Definitions where d.Name == name select d); if (v == null || v.Count() < 1) { return(null); //There is no Shared parameter with this name } ExternalDefinition def = v.First(); return(def); }