web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Fetch XML in C# using Xrm.SDK

(0) ShareShare
ReportReport
Posted on by

Hi,


In CRM 4.0 and CRM 11 there is function Fetch() to get data from the XML, we can do that using Crm.SDK but in Xrm.SDK there is no function available name Fetch().


I have used Odata with JavaScript, but i don't know how to use it with C#.

Please Help...!!!

Thanks

*This post is locked for comments

I have the same question (0)
  • Verified answer
    Aileen Gusni Profile Picture
    44,524 on at

    Hi Chirag,

    You can use

    RetrieveMultiple(new FetchExpression(fetchxml)) function.

    But, different from .Fetch() in CRM 4.0, both input and output are string XML.

    in CRM 2011 and CRM 2013 we can use XML as input using that FetchExpression(fetchxml), but it will return EntityCollection()

    See this:

    msdn.microsoft.com/.../gg328117.aspx

    msdn.microsoft.com/.../gg328332.aspx

    Hope this helps!

    Thanks.

  • Waqar Sohail Profile Picture
    on at

    Hi You can also use Query Expression to retrieve Data in C#.

    QueryExpression query = new QueryExpression("EntityLogicalName");
    query.ColumnSet = new ColumnSet("column1", "coumn2");
    // Or retrieve All Columns
    //query.ColumnSet = new ColumnSet(true);
    
    query.Criteria.Conditions.Add(new ConditionExpression("status", ConditionOperator.Equal, 1));
    
    var result = service.RetrieveMultiple(query);
    
    foreach (var entity in result.Entities)
      {
      // Get the Columns from the Entity Obj Like this. Depands on type of the Column. 
       string entityColumn1 = entity.Contains("column1") ? entity["column1"].ToString() : string.Empty;
      }

    Regards

  • suresh maurya Profile Picture
    630 on at

    For testing of FetchXML, you can test here online http://msxrmtools.com

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans