Example #1
0
        public static List <dynamic> ReadFromFetchXml(IDynamicsCrmConnection dynamicsCrmConnection, string entityName, List <string> fields, Dictionary <string, string> keyContent, int?maxCount, PagingInformation pagingInformation)
        {
            XDocument xDocument = new XDocument(
                new XElement("fetch",
                             new XElement("entity", new XAttribute("name", entityName),
                                          new XElement("filter"))));

            if (maxCount.HasValue)
            {
                xDocument.Element("fetch").Add(new XAttribute("count", maxCount.Value));
            }

            xDocument.Element("fetch").Element("entity").Add(StaticCrm.GetAttributeElements(fields.ToList()));
            xDocument.Element("fetch").Element("entity").Element("filter").Add(StaticCrm.GetConditionElements(keyContent));

            List <dynamic> crmObjects = ReadFromFetchXml(dynamicsCrmConnection, xDocument, pagingInformation);

            return(crmObjects);
        }