Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Convert CRM 2011 FetchXML to to XML file?

(0) ShareShare
ReportReport
Posted on by 2,715

Hello All,

       I  have a fetchxml like below

<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false">
<entity name="account">
<attribute name="name" />
<attribute name="primarycontactid" />
<attribute name="telephone1" />
<attribute name="accountid" />
<order attribute="name" descending="false" />
<filter type="and">
<condition attribute="ownerid" operator="eq" uiname="Ramakanta" uitype="systemuser" value="{C58BB8C2-E6AB-E611-80BA-00155DF0A51F}" />
</filter>
</entity>
</fetch>

 

Now i want  simply read the value present in ownerid(i.e.uiname ).I don't want execute the query and  retrieve the result using service.RetriveMultiple();

What i am thinking is converting the Fetchxml into xml then reading the node but i am  not getting the inner xml value.

 

*This post is locked for comments

  • Ramakanta Profile Picture
    Ramakanta 2,715 on at
    RE: Convert CRM 2011 FetchXML to to XML file?

    Thanks..It works

  • Verified answer
    a33ik Profile Picture
    a33ik 84,325 Most Valuable Professional on at
    RE: Convert CRM 2011 FetchXML to to XML file?

    Ramakanta Here is code you can use for parsing:

                var xml = @"<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='false'>
    <entity name='account'>
    <attribute name='name' />
    <attribute name='primarycontactid' />
    <attribute name='telephone1' />
    <attribute name='accountid' />
    <order attribute='name' descending='false' />
    <filter type='and'>
    <condition attribute='ownerid' operator='eq' uiname='Ramakanta' uitype='systemuser' value='{C58BB8C2-E6AB-E611-80BA-00155DF0A51F}' />
    </filter>
    </entity>
    </fetch>";
    
                var document = new XmlDocument();
                document.LoadXml(xml);
    
                var conditionNode = document.SelectSingleNode("//fetch/entity/filter/condition");
    
                Console.WriteLine(conditionNode.Attributes["uiname"].Value);
                Console.ReadLine();]
    


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

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Kudos to the February Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,516 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,407 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans