Message 1 of 4
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi
I've created a part from a linked file and I'm trying to get the parent of that part.
I found that code that work when the parent is in the same document that the part but it returns "-1" when the parent is in the linked document.
Document documentlie = doc;
//On crée la variable pour le document lié.
foreach (Document dmt in uiapp.Application.Documents)
{
if (dmt != doc) documentlie = dmt;
}
Element elt;
Part elementpart = elt as Part;
ICollection<LinkElementId> lIds = elementpart. GetSourceElementIds();
LinkElementId lId = lIds.First<LinkElementId>();
ElementId parentElementId = lId.HostElementId;
TaskDialog.Show(" parentElementId", parentElementId.ToString());//return the right id when the parent is in the same file and "-1" when it's in a linked document
Thanks for your help.
Alexandre
Solved! Go to Solution.