Imports WebServicesGP2010.Legacy
Public Class GetCustomerByKeyLegacy
Sub getCustomerByKeyLegacy()
Dim CompanyKey As Legacy.CompanyKey
Dim Context As Legacy.Context
Dim Customer As Legacy.Customer
Dim CustomerKey As Legacy.CustomerKey
' Create an instance of the service
'this is the legacy endpoint. You'll find a discussion on Legacy vs Native and how to connect to both here:
'http://dyndeveloper.com/articleview.aspx?ArticleID=62
Dim wsDynamicsGP As DynamicsGP = New DynamicsGP
' Be sure that default credentials are being used
wsDynamicsGP.UseDefaultCredentials = True
' Create a context with which to call the service
Context = New Context()
' Specify which company to use (sample company)
CompanyKey = New CompanyKey()
CompanyKey.Id = (-1)
' Set up the context
Context.OrganizationKey = CType(CompanyKey, OrganizationKey)
' Create a customer key
CustomerKey = New CustomerKey()
CustomerKey.Id = "AARONFIT0001"
' Retrieve the customer object
Customer = wsDynamicsGP.GetCustomerByKey(CustomerKey, Context)
MessageBox.Show(Customer.Name)
End Sub
End Class