Dear dojo,
I'm creating an automation script where i read a view Property through
IDms dms = engine.GetDms();
IDmsView myView = dms.GetView(Convert.ToInt16( viewid ));
IDmsViewProperty myViewProperty = myView.Properties.SingleOrDefault(x => x.Definition.Name == "myPropertyName");
This part is fine but when i try to update the Value with
myViewProperty.Value = "new value";
i get the message "myViewProperty.Value cannot be assigned to -- it is read only"
I'm able to assign a value manually. So i don't understand why this property should be read only.
Is there a way to manipulate this?
Thanks
Hi Tom,
Cool! This makes sense. Thank you for information.
Hi Michael,
This example shows how to update properties of an element. A similar approach can be used to update properties of views: https://docs.dataminer.services/develop/devguide/ClassLibrary/ClassLibraryExamples.html#setting-a-property-and-renaming-the-element.
The trick is to first cast the property to IWritableProperty.
Hi Michael. Based on this question and other feedback, we decided to make setting properties on elements, services and views a bit more intuitive. The property object now contain IsWritable and AsWritable methods, which replace the cast to IWritableProperty. This has been implemented in version 1.1.1.8 of the DMS library.