I'm using the Partner WSDL to query contacts via .Net.

I have simple SOQL query that pulls back every Contact with their email and Account Name:

SELECT Email, Account.Name FROM Contact

However when I inspect the sObject records that this returns, the Account Name field InnerText value is always prefixed with 'Account' e.g. 'AccountGrand Hotels & Resorts Ltd'.

Am I expected to strip off the 'Account' prefix or am I doing something incorrect. Below is an extract of the .Net code which queries the Contacts.

Dim soqlQuery As String = "SELECT Email, Account.Name FROM Contact"

Dim queryResult As QueryResult = Nothing

queryResult = helperBase.SoapClient.query(soqlQuery)

' when inspecting the below records 'Account' is prefixed to InnerText value
Dim records As Array = queryResult.records

You need to type cast the result of helperBase.SoapClient.query(soqlQuery) like

List lstContacts = (List)helperBase.SoapClient.query(soqlQuery)


  • Hi Prakash, I don't understand. The type 'QueryResult' is fine here, I am able to loop through queryResult.records and get the sObjects that I need. How would type casting the Query Result help here? – Ronnie Mar 10 '15 at 13:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.