Wednesday, March 7, 2012

How to Retrieve an Entity Instance in Microsoft Dynamics CRM 2011 with VB.NET

This illustration shows how to use RetrieveRequest to retrieve an entity instance in Microsoft Dynamics CRM 2011 with VB.NET

Ok, here is what the code looks like!

In VB.NET

'Method 1
Dim reqRetrieve1 As New RetrieveRequest()
reqRetrieve1.ColumnSet = New ColumnSet(True)
reqRetrieve1.Target = New EntityReference(Account.EntityLogicalName, New Guid("CCB265C9-5F0C-E111-BF0B-1CC1DEE89AA8"))
Dim respRetrieve1 As RetrieveResponse = DirectCast(slos.Execute(reqRetrieve1), RetrieveResponse)

'Method2
Dim entRetrieved As Entity = slos.Retrieve(Account.EntityLogicalName, New Guid("CCB265C9-5F0C-E111-BF0B-1CC1DEE89AA8"), New ColumnSet(True))


Thats all there is to it!
-

No comments:

Post a Comment