1

As the title suggests,

When and why would we use RetrieveMultipleRequest over Service.Retrievemultiple?

Can I please get one or two scenarios where one would be more preferable to the other?

My understanding is that RetrieveMultipleRequest is similar to doing a FetchXML query (and can in fact use FetchXML instead of a queryexpression).

Is this the reason? If so, what can you do in a FetchXML query you can't do in a QueryExpression?

user1173691
  • 443
  • 2
  • 6
  • 15

2 Answers2

3

According to the CRM 3.0 docs,

CrmService (IOrganizationService in CRM 2011) contains a set of methods common to many entities.

So the RetrieveMultiple method of the IOrganizationService interface is a shortcut method for the RetrieveMultipleRequest and RetrieveMultipleResponse action pairs. This is best seen when looking at the documentation for the RetriveMultipleRequest class on MSDN: the documented example references the IOrganizationService's RetrieveMultiple method, not the RetrieveMultipleRequest or the RetrieveMultipleResponse classes, which would also suggest Microsoft intends the two to be interchangeable.

Because they are interchangeable, you can pass FetchXml to the RetrieveMultiple method. See Anwar's answer to a similar question to see how and why you'd use FetchXml.

Community
  • 1
  • 1
Peter Majeed
  • 5,304
  • 2
  • 32
  • 57
1

RetrieveMultiple method creates instance of RetrieveMultipleRequest class and sends it to server. No special purpose to use RetrieveMultipleClass directly.

paramosh
  • 2,258
  • 1
  • 15
  • 23