Here is some code from the CRUDOperations.vb file in Microsoft Dynamics CRM 2011 SDK:
' Retrieve the account containing several of its attributes.
Dim cols As New ColumnSet(New String() { "name", "address1_postalcode", "lastusedincampaign" })
Dim retrievedAccount As Account = CType(_service.Retrieve("account", _accountId, cols), Account)
Console.Write("retrieved, ")
' Update the postal code attribute.
retrievedAccount.Address1_PostalCode = "98052"
' The address 2 postal code was set accidentally, so set it to null.
retrievedAccount.Address2_PostalCode = Nothing
Now if I am understanding correctly, the following line:
Dim retrievedAccount As Account = CType(_service.Retrieve("account", _accountId, cols), Account)
Doesn’t seem to actually do anything?
_service.Retrieve("account", _accountId, cols)Account.retrievedAccount.And then the subsequent lines modify the properties of the account that is referenced by
retrievedAccount.