MSCRM 4.0 SDK Sample ERROR
-
26. august 2008 08:39Hi,
i'm trying to bind data from a crm entity to a datagrid, and i've followed all the steps mentioned in the documentation provided with the sample!
but i'm having an Exception "_COMPlusExceptionCode = -532459699" when i execute the code witch should bind the datagrid
try
{
// Connect to CRM and execute a standard query that will return a collection
// of account records.
CrmService service = new CrmService();
service.Credentials = System.Net.CredentialCache.DefaultCredentials;
CrmAuthenticationToken token = new CrmAuthenticationToken();
// TODO Replace 'Adventure Works Cycle' with your Microsoft CRM organization name.
token.OrganizationName = "LitwareInc";
service.CrmAuthenticationTokenValue = token;
// TODO Replace 'localhost:5555' with your CRM server information.
service.Url = @"http://localhost:5555/MSCRMServices/2007/CrmService.asmx";
QueryExpression query = new QueryExpression();
// Limit the results
query.PageInfo = new PagingInfo();
query.PageInfo.Count = 10;
query.PageInfo.PageNumber = 1;
query.EntityName = EntityName.contact.ToString();
//query.EntityName = EntityName.account.ToString();
query.ColumnSet = new AllColumns();
RetrieveMultipleRequest rm = new RetrieveMultipleRequest();
rm.Query = query;
rm.ReturnDynamicEntities = true; // The UniversalEntityList only supports dynamic entities
RetrieveMultipleResponse rmOut = (RetrieveMultipleResponse)service.Execute(rm);
UniversalEntityList entityList = new UniversalEntityList(rmOut.BusinessEntityCollection);
this.dataGridView.DataSource = entityList;
}
catch (System.Web.Services.Protocols.SoapException)
{
// Perform error handling here.
throw;
}
catch (Exception)
{
throw;
}
can any one help me please!?
thanks in advanced
Alle besvarelser
-
28. august 2008 18:17
One thing that I can see missing is the AuthenticationType for token.
You need to add the line:
token.AuthenticationType = <value> where value = 0 for On premise CRM, 1 for CRM Online, and 2 for IFD.
However, this should be causing an unauthorised exception, and not a COM plus exception.