Reputation: 33
I want to change element name by API and I have the following code.
Reference r = docUI.Selection.PickObject(ObjectType.Element, "Please pick an element");
Element element = doc.GetElement(r.ElementId);
element.Name = "MyElement";
But why occured this error ? 'This element does not support assignment of a user-specified name.' Or should I change the name by another way ?
Please help!
Upvotes: 1
Views: 1035
Reputation: 76
I believe you have to change the Element Type to change its Name. Something like the following:
element.ChangeTypeId(anotherElementTypeId);
Upvotes: 1
Reputation: 169
Element names can't be changed. If you are actually looking to change the name of the element "type", that is editable.
Upvotes: 3