Hi there,
I am trying to get the names of file properties on a specific ItemType. The FileTestType1 has two properties (_attachement_1, attachement_2) with data_type = Item and data_source = File. I wrote this external C#-method:
List<String> results = new List<String>();
String itemType = "FileTestType1";
Item itm = inn.newItem("ItemType", "get");
itm.setProperty("name", itemType);
itm = itm.apply();
itm.fetchRelationships("Property");
Item relationships = itm.getRelationships("Property");
int count = relationships.getItemCount();
for (int i = 0; i < count; i++) {
Item prop = relationships.getItemByIndex(i);
if (prop.getProperty("data_type") == "Item" && prop.getPropertyItem("data_source").getProperty("name") == "File"){
results.Add(prop.getProperty("name"));
}
}
Unfortunately the results-List stays empty. When I debug the thing it looks like the prop-Item is assigned the sourceItem instead of the RelationshipItem, so there are no data_type or data_source properties on it.
getRelatedItem won't do since the "Property" Relation of "ItemType" is a NoRelated, data_type and data_source hence stickng directly on the Relationship-ItemType.
What is the correct way to get to access the Property-Relationship-Items or is there another way to get to an ItemType's properties' metadata?
Best regards, Sebastian