There are two steps you need to do:
- Find the parent element (AFElement class) which a child element will be created
- Use the Add method of the Elements property of the AFElement class to create an element
Don't forget to check in in order to save the results!
Here is an example:
AFElement parentElement = AFObject.FindObject(elementPath) as AFElement; AFElement childElement = parentElement.Elements.Add("childElement"); parentElement.Database.CheckIn(AFCheckedOutMode.ObjectsCheckedOutThisSession);
Hope it helps!
Thank you Marcos Vainer Loeff, that did exactly what i needed. I have a lot to learn about both subjects here, c# and AF SDK, but now that i'm diving into it more, it's making more sense. At first i was confused at the checkin method you were using, and why not just use the empty overflow, but i can see that this way you only checkin what you modified, which is much cleaner, probably why you use it.