How to add a custom property in service creation via automation script and how to retrieve its value
Dear Apurva,
As far as I know, You can use the class library in your Automation script and can get/set the values.
https://docs.dataminer.services/develop/devguide/ClassLibrary/ClassLibraryIntroduction.html
Example:-
https://docs.dataminer.services/develop/devguide/ClassLibrary/ClassLibraryExamples.html
//Read
IDms myDms = engine.GetDms();
IDmsView myView = myDms.GetView("my View Name");
IDmsViewProperty myProperty = myView.Properties.SingleOrDefault(x => x.Definition.Name == "property name");
//write
IDms dms = protocol.GetDms();
IDmsElement element = dms.GetElement(new DmsElementId(346, 529981));
element.Name = "Renamed Element";
if (element.Properties["CustomProperty"].IsWritable)
{
IWritableProperty myProperty = element.Properties["CustomProperty"].AsWritable();
myProperty.Value = "A";
}
else
{
// "My Property" is a read-only property.
}
element.Update(); // Apply the changes.
Hi Apurva,
I see that this question has been inactive for some time. Do you still need help with this? If not, could you select the answer that has been most helpful for you (using the ✓ icon)?