Hi, Does anyone can tell me (code snippet) on how to delete weak reference type element in code C#?
You just need to call the Elements.Remove method on the parent element that contains the referenced element:
I am using the same API to remove weak reference type elements. It usually works but I am having problems intermittently
Scenario when it works:
afParent.Elements.Remove( "AD.Dx" );
returns 438 (The count did decrease, works great!)
Scenario with same API call:
afParent.Elements.Remove( "Ma" );
return true (found the item and it returns true. So it should have removed the element)
returns 438 (!!!!! Problem, the item was never removed)
Also tried to perform checkin for parent element after Remove but still no luck for certain elements.
Please kindly let me know if you have a solution for this.
If the element "Ma" does not actually exist in the collection, you will not get an error but nothing will be deleted. The Remove method returns a bool value which you can check to see if the object was actually removed from the collection.
Retrieving data ...