2021 Property
Changes 0
P

Element.CreatedPhaseId

Description:
Id of a Phase at which the Element was created.
Remarks:
After setting the property CreatedPhaseId regeneration can fail if CreatedPhaseId and DemolishedPhaseId are out of order, i.e. their index in the property Document.Phases.
public ElementId CreatedPhaseId { get; set; }
void ShowPhaseCreatedName(Element element)
{
    // Get the Phase Create property, and assert it should not be null
    Autodesk.Revit.DB.Phase phaseCreated = element.Document.GetElement(element.CreatedPhaseId) as Phase;
    if (null == phaseCreated)
    {
        throw new Exception("Elements always have a phase for when they are created.");
    }
    else
    {
        // Show the Phase Create name to the user.
        String prompt = "The phase created is: " + phaseCreated.Name;
        TaskDialog.Show("Revit",prompt);
    }
}