AddToDocumentWithName Method
Adds a property set from a library to the document. The property set will be available for use even if the library is unloaded.

Namespace: Autodesk.Revit.DB
Assembly: RevitAPI (in RevitAPI.dll) Version: 2015.0.0.0 (2015.0.0.0)
Since:  2012

Syntax

C#
public PropertySetElement AddToDocumentWithName(
	string name,
	Document document,
	bool overwrite,
	string addAsName
)
Visual Basic
Public Function AddToDocumentWithName ( _
	name As String, _
	document As Document, _
	overwrite As Boolean, _
	addAsName As String _
) As PropertySetElement
Visual C++
public:
PropertySetElement^ AddToDocumentWithName(
	String^ name, 
	Document^ document, 
	bool overwrite, 
	String^ addAsName
)

Parameters

name
Type: System..::..String
The name of the property set in the library to add to the document.
document
Type: Autodesk.Revit.DB..::..Document
The document to which the property set will be added.
overwrite
Type: System..::..Boolean
If true, any existing property set with the given name will be overwritten.
addAsName
Type: System..::..String
The name to use for the new property set element in the document.

Return Value

The new PropertySetElement.

Exceptions

ExceptionCondition
Autodesk.Revit.Exceptions..::..ArgumentException No property set with the given name exists in the library. -or- addAsName is an empty string.
Autodesk.Revit.Exceptions..::..ArgumentNullException A non-optional argument was NULL
Autodesk.Revit.Exceptions..::..InvalidOperationException a PropertySetElement with the given name already exists and the overwrite flag is false.

See Also