Источник:
http://crmpro.blogspot.com/2009/10/h...y-to-many.html
==============
If you need to retrieve something from many-to-many relationship entity, and there is no such entity in CRM, then you should use the FetchXml, instead of Query.
// Base bodel of FetchXml for get relationship entity
string fetchXML =
"" +
"" +
"" +
"" +
"" + "";
For example, next code snippet is checking a count of relations between the Account entity and New_Industry entity, wich relationship is many-to-many. To achieve this, I need to check the relationship entity - New_industry_account, wich is contains all of relation of our two entities.
ICrmService crmService = context.CreateCrmService(true);
// check for relation
#region FetchXML
string fetchXML =
"" +
"" +
"" +
"";
#endregion
string fetchresult = crmService.Fetch(fetchXML);
XmlDocument xmldoc = new XmlDocument();
xmldoc.LoadXml(fetchresult);
XmlNodeList xnodlist = xmldoc.SelectNodes("resultset/result");
if (xnodlist.Count > 0) { return; }
Источник:
http://crmpro.blogspot.com/2009/10/h...y-to-many.html