Showing results for 
Show  only  | Search instead for 
Did you mean: 

MetaClass - GetCollection:Name 'MetaAttribute' is not a valid argument


MetaClass - GetCollection:Name 'MetaAttribute' is not a valid argument

I am getting an error "MEGA Error 80020009(MegaObject.GetCollection) : MegaObject.GetCollection:Name 'MetaAttribute' is not a valid argument" when following this code path:


instance.getClassObject().getCollection("MetaAttribute", "")


while the following code path produces the expected results


root.getObject(metaClassID).getCollection("MetaAttribute", "")


I have verified that the MegaObjects returned by root.getObject(metaClassID) and instance.getClassObject() have the same ID and Name, so the error appears odd. These are the questions that arose from this:


Why does the first code throw an error where the second succeeds?

What is the difference between instance.getClassObject() and root.getObject() with appropriate ID?

How can I work around this behaviour in Java if I only have the MegaObject instance and need to get its MetaClass Object?