I am having trouble getting the getPropertyItem API function to work. I hope someone may be able to point out what I am doing wrong. My goal is, given the name of a Relationship type, to find the source and related items for this relationship type. There might even be more elegant ways to do what I am trying to accomplish, but I woud still like to know if I am using the API function correctly.
Pretty simple:
If I do this:
IOM.Item itDis = Inn.newItem("relationshipType", "get");
itDis.setProperty("name", "mw_counter_To_kpi");
IOM.Item result = itDis.apply();
textBox1.Text = result.dom.InnerXml;
<Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<source_id keyed_name="mw_ctr_01" type="ItemType" name="mw_ctr_01">3AE49E0CE2BD4E108EBC459A94781B6C</source_id>
...
So, the related_id and source_id Item types are what I am looking for.
I try this:
IOM.
itDis.setProperty(
textBox1.Text = itemProp.dom.InnerXml;
I get an error message. The API command is so straight forward I am not sure what else to try. Am I mis-interpreting something about the command or perhaps the Relationship Type item type?
Any help will be greatly appreciated.
Mark
Please pay attention that there is no tag Item inside tag source_id. Thus getPropertyItem is not applicable.
If you try
IOM.Item itemProp = result.getPropertyItem("related_id");
this should work.
Since you know ItemType id you may request the ItemType. For example:
string id = result.getProperty("source_id"); IOM.Item it = Inn.newItem("ItemType", "get"); it.setID(id); it = it.apply();
Also I noticed that you specified incorrect type name. That should be RelationshipType and not relationshipType.