Dear Sirs, I'm using C# .Net and a Service Reference to run queries on CRM 7.1 API. The problem is that I get null (or default) values for most fields while running queryentity, query, etc. In the other hand, queryrecord works fine, although it's cumbersome as it forces me to specify each field name and type I want to retrieve one by one.
Please find below the code I'm using. For any reason it successfully retrieves one record including the actual primarypersonid but fails to get the values for the rest of the fields. I've checked everyone have access to the fields on CRM, they are appearing on the WSDL, the values can be seen in SQL Management Studio and they can be get by using queryrecord. Any ideas?
public static void Test()
{
HotelrezCrm crm = new HotelrezCrm();
WebServiceSoapPortClient ws = new WebServiceSoapPortClient();
crm.LogOn();
ewarebaselist CRMCompanyEmails = new ewarebaselist();
queryentityresult CRMEntityResult = ws.queryentity(crm._sessionheader, 12228, "company");
company CRMCompany = (company)CRMEntityResult.records;
crm.LogOff();
}
public void LogOn()
{
this.LogOn(DEFAULT_USER, DEFAULT_PASSWORD);
}
public void LogOn(string user, string password)
{
WebServiceSoapPort service = new WebServiceSoapPortClient();
logonRequest logonrequest = new logonRequest();
logonrequest.username = user;
logonrequest.password = password;
logonResponse logonresponse = service.logon(logonrequest);
_sessionheader = new SessionHeader();
_sessionheader.sessionId = logonresponse.result.sessionid;
_loggedon = true;
}