Harness proD API Help
EPLAN.Harness.API.Projects.Documents Namespace / Project Class / UserDefinedProperties Property
Example
In This Topic
    UserDefinedProperties Property (Project)
    In This Topic
    List of User-defined properties of this document or project.
    Syntax
    public override IList<UserDefinedProperty> UserDefinedProperties {get; set;}
    Exceptions
    ExceptionDescription
    The object is in invalid state. Obtain a new one.

    Internal error of HpD or HpD API.

    IMPORTANT: Throwing this exception changes HpD Api's state to Failed.

    The exception that is thrown when a user-defined property with this name already exists on this object.
    Example
    The following example shows how to use a list of user-defined properties.
    // An object with user-defined properties was obtained before...
    // For example: Project.
    
    // Get user-defined properties of the project.
    IList<UserDefinedProperty> props = project.UserDefinedProperties;
    
    // Edit list of user-defined properties - the list is changed immediately.
    // Remove property:
    project.UserDefinedProperties.Remove(props.Last());
    // Add new property:
    project.UserDefinedProperties.Add(new UserDefinedProperty("Name of the property", new TextProperty("Value of the property")));
    // Edit property:
    project.UserDefinedProperties.First(p => p.Name == "Name").Name = "New name";
    
    // Save the project.
    project.Save();
    See Also