tips & tricks


Calendario
aprile 2024
lmmgvsd
25262728293031
1234567
891011121314
15161718192021
22232425262728
293012345

FetchXml

La fetch è uno strumento molto utile e veloce se si devono fare dei controlli. Una funzione per gestire comodamente le fetch Xml in crm.

public static int GetParticipationCount(string entityName, string attributeName, object attributeValue)
      {
         string fetchXml = @"
   <fetch mapping=""logical"" aggregate=""true"">
   <entity name=""{0}"">
    <attribute name=""{1}"" aggregate=""count"" alias=""count"" />
    <filter>
     <condition attribute=""{1}"" operator=""eq"" value=""{2}"" />
    </filter>
   </entity>
   </fetch>
   ";

         fetchXml = string.Format(fetchXml, entityName, attributeName, attributeValue);


         string xml = service.Fetch(fetchXml);
         XmlDocument doc = new XmlDocument();
         doc.LoadXml(xml);

         XmlNode node = doc.SelectSingleNode("/resultset/result/count");

         int count = Convert.ToInt32(node.InnerXml);

         return count;

      }

Categoria: CRM 4.0
mercoledì, 10 giu 2009 Ore. 14.33
Archivio Posts
Anno 2020

Anno 2018

Anno 2015

Anno 2013

Anno 2011

Anno 2010

Anno 2009

Anno 2008
Statistiche
  • Views Home Page: 13.353
  • Views Posts: 56.054
  • Views Gallerie: 2.837
  • n° Posts: 117
  • n° Commenti: 1
Copyright © 2002-2007 - Blogs 2.0
dotNetHell.it | Home Page Blogs
ASP.NET 2.0 Windows 2003