Thursday, December 29, 2011

Using RetrieveMultipleRequest in Microsoft Dynamics CRM 2011 in VB .NET

RetrieveMultiple is probably the most common request I use so I figured I better add a decent VB.NET example to my example index. This illustration shows how to use the RetrieveMultipleRequest in Microsoft Dynamics CRM 2011 with VB.NET

Ok, here is what the code looks like!

In VB.NET

 Dim rmr As New RetrieveMultipleRequest()
 Dim resp As New RetrieveMultipleResponse()

 Dim qry As New QueryExpression()
 qry.EntityName = "systemuser"
 qry.ColumnSet = New ColumnSet(True)
 qry.Criteria = New FilterExpression()
 qry.Criteria.FilterOperator = LogicalOperator.And

 Dim cnd As New ConditionExpression()
 cnd.AttributeName = "organizationid"
 cnd.Operator = ConditionOperator.Equal
 cnd.Values.Add("f5d3e6d4-61b5-4739-af1b-a8ca3232a4e3")
 qry.Criteria.Conditions.Add(cnd)

 rmr.Query = qry
 resp = DirectCast(slos.Execute(rmr), RetrieveMultipleResponse)


Thats all there is to it!
-

No comments:

Post a Comment