get link element revit api
UIApplication uiapp = commandData.Application;
UIDocument uidoc = uiapp.ActiveUIDocument;
Application app = uiapp.Application;
Document doc = uidoc.Document;
ObjectType obt=ObjectType.LinkedElement;
Reference refElemLinked;
Element linkedelement = null;
refElemLinked = uidoc.Selection.PickObject(obt, "Please pick an element in the linked model");
RevitLinkInstance elem = doc.GetElement(refElemLinked.ElementId) as RevitLinkInstance;
Document docLinked = elem.GetLinkDocument();
linkedelement = docLinked.GetElement(refElemLinked.LinkedElementId);