【问题标题】:How do you parse the result of a FetchXML request?如何解析 FetchXML 请求的结果?
【发布时间】:2011-09-18 09:45:02
【问题描述】:

如何解析以下 FetchXML 请求的结果?

string fetch_checkEntity = @"
     <fetch mapping='logical'>
       <entity name='" + entityname + @"'>
         <attribute name='" + columnname + @"' />
         <attribute name='" + logicalnameid + @"' />
         <order attribute='" + columnname + @"' />
           <filter>
             <condition attribute='statecode' operator='eq' value='0' />
             <condition attribute='statuscode' operator='eq' value='1' />
           </filter>
         </entity>
       </fetch>";

string result_checkEntity = crmService.Fetch(fetch_checkEntity);

【问题讨论】:

  • 我的回答对您有任何帮助吗?是不是模棱两可?

标签: dynamics-crm-4 crm fetchxml


【解决方案1】:

我建议使用XDocument 功能来解析 fetch 语句的结果。
我不确切知道resultset 的样子,但这里有一些关于如何进行解析的提示。

XDocument xml = XDocument.Parse(result_checkEntity);  

var results = from item in xml.Elements("result")  
               select new  // creating an anonymous type
               {  
                   element = (type of value) //casting operation to what you have: string, Guid, etc
                             item.Element("  ") // in the paranthesis put the name 
                                                // of the element you are interesting 
                                                // in getting back; columnname 
               }; 

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2018-11-09
    • 1970-01-01
    • 2015-05-10
    • 2015-06-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多