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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

IOrganizationService.RetrieveMultiple

(0) ShareShare
ReportReport
Posted on by 10
Hello, help to make visual project studio C #, I need to export records of my entity Product.

Subsequently those records serialize them to XML.

I need an example.

This method is correct: IOrganizationService.RetrieveMultiple ???

I appreciate the support.

regards!

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    RaviKashyap Profile Picture
    55,410 Moderator on at

    Hi,

    RetrieveMultiple message will return the collection of entity objects. Once retrieved you can use below sample to serielze it accordingly-

    docs.microsoft.com/.../sample-serialize-deserialize-entity-instance

    Hope this helps.

  • Arturo Nava Profile Picture
    10 on at

    Hi, thanks for the serialize example, I already have it ...

    The problem I have is to connect to my organization and extract the products from the Product entity.

    help me

  • Verified answer
    N.A.R.A Profile Picture
    95 on at

    This is the example

    The result are entity collection, you can just convert to list of entity

    using Microsoft.Xrm.Sdk;
    using Microsoft.Xrm.Sdk.Query;
    
    
    
    //This is how to connect
    
    ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
    
    Uri crmOrganizationUri = new Uri("yourorganizationurl");
    var credentials = new ClientCredentials()
    {
    UserName = { UserName = "yourusername", Password = "yourpassword" }
    };
    var serviceProxy = new OrganizationServiceProxy(crmOrganizationUri, null, credentials, null);
    serviceProxy.EnableProxyTypes();
    if (impersonateGuid != default(Guid))
    {
    serviceProxy.CallerId = impersonateGuid;
    }
    
    
    
    //This is how to query
    
    QueryExpression productQe = new QueryExpression()
    {
    EntityName = "product",
    ColumnSet = new ColumnSet(true),
    Criteria = new FilterExpression()
    {
    //if you want add condition
    Conditions = { new ConditionExpression("name", ConditionOperator.Equal, "Arturo Nava") }
    }
    };
    EntityCollection productEc = serviceProxy.RetrieveMultiple(productQe);
    
    


    Good Luck 

  • Suggested answer
    Kokulan Profile Picture
    18,054 on at

    Hi

    The following query will help you to retrieve products

    // Instantiate QueryExpression QEproduct

    var QEproduct = new QueryExpression("product");

    // Add columns to QEproduct.ColumnSet

    QEproduct.ColumnSet.AddColumns("name", "productid", "productnumber", "description", "statecode", "productstructure");

    QEproduct.AddOrder("productnumber", OrderType.Ascending);

    CrmService.RetrieveMultiple(QEproduct );

    If you are not familiar with building query using query expression, you can use the XrmToolBox Fetch XML builder as shown below

    01. Build your query in advance find and download the FETCH

    02. Paste your FETCH and Convert to Query Expression C# code as shown below

    1524.ScreenClip-_5B00_76_5D00_.png

    1524.ScreenClip-_5B00_76_5D00_.png

    Once you got the results, you can serialise or de-serialise as described in the link below

    https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/org-service/sample-serialize-deserialize-entity-instance

  • Arturo Nava Profile Picture
    10 on at

    Hello N.A.R.A, I appreciate your help and time, I tell you to do what you send, ask, why does not show the method RetrieveMultiple ???

    What is the error?

    Regards!

  • Arturo Nava Profile Picture
    10 on at

    Hello N.A.R.A, review and the RetrieveMultiple method, it is shown with _service.

    not with serviceProxy

    Regards!

  • Arturo Nava Profile Picture
    10 on at

    I appreciate your support Ravi, to be serialized.

    Do you have an example for RetriveMultiple ??

    Thanks for your support.

  • Arturo Nava Profile Picture
    10 on at

    Hello Kokulan,

    Thanks for answering ,,, Question..What is the difference between IOrganizationService.RetrieveMultiple vs. CrmService.RetrieveMultiple ????

    Is the same??

    I appreciate your support.

    regards!

  • Verified answer
    Kokulan Profile Picture
    18,054 on at

    Hi Arturo

    CrmService in my example is just the variable name for OrganizationService, yes you are right its referring to the same IOrganizationService.RetrieveMultiple.

  • Arturo Nava Profile Picture
    10 on at

    Kokulan, I understand, I appreciate your help, thank you!

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the April Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
ScottDurow Profile Picture

ScottDurow 2

#2
GJones Profile Picture

GJones 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans