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!


 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

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

Thats all there is to it!

No comments:

Post a Comment