Optimized copy of full list of properties of a specific User Defined category to another item
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I think I'm missing/overlooking something, so maybe someone can help đ
I know how to "read" a list of properties associated to a specific user defined category, using low level calls to access InwGUIAttribute2 and then its properties collection InwOaPropertyColl :
// shortened code here
// get item guiNode
var guiNode = (InwGUIPropertyNode2)ComApiBridge.State.GetGUIPropertyNode((InwOaPath3)ComApiBridge.ToInwOaPath(anItem), false);
// get its categories
var categories = propNode.GUIAttributes();
// iterate through categories to find the searched one(s)
for (int i = 1; i <= categories.Count; i++)
var guiattrib = (InwGUIAttribute2)categories[i];
[... check for searched one]
// access properties
InwOaPropertyColl oapc = category.Properties();
foreach (InwOaProperty oap in oapc)
{ [... do stuff]}
I also know how to create a list of properties InwOaPropertyColl using a InwOaPropertyVec and add them as User Defined properties:
// Create Properties vector, a container for a InwOaPropertyColl
var propertiesVector = (InwOaPropertyVec)ComApiBridge.State.ObjectFactory(nwEObjectType.eObjectType_nwOaPropertyVec, null, null);
// get properties collection
var properties = propertiesVector.Properties();
// add properties
// one example here
var prop = (InwOaProperty)ComApiBridge.State.ObjectFactory(nwEObjectType.eObjectType_nwOaProperty, null, null);
prop.name = @""Banner";
prop.value = @"Hello World;
properties.Add(prop);
[...]
// Add this vector as a new User-defined category
guiNode.SetUserDefined(udIndex, categoryName, categoryName, properties);
However I can't find a way to do a simple Copy of a list of properties to a new item/category.
From the read part, I got a InwGUIAttribute2 and its InwOaPropertyColl
For the write part however I need a InwOaPropertyVec. While I can create one I can't assign to it the InwOaPropertyColl I got, InwGUIAttribute2 is not a subclass of InwOaPropertyVec so I can't pass it to guiNode.SetUserDefined.
Of course I can recreate a full copy of the properties but this is super-inefficient.
What am I missing??