I am trying to fetch data from MS dynamic CRM 2011 on following environment
- Dynamic CRM 2011 On-premise using Windows authentication.
- Microsoft.crm.sdk.dll and microsoft.crm.sdktypeproxy.dll references.
- C# .NET Windows Form visual studio 2012
I have been getting the following MSDN resources.
CrmAuthenticationToken token = new CrmAuthenticationToken(); // You can use enums.cs from the SDK\Helpers folder to get the enumeration for Active Directory authentication. token.AuthenticationType =0; //token.OrganizationName = "AdventureWorksCycle"; token.OrganizationName = "CRM4"; CrmService service = new CrmService(); service.Url = "http://servername:5555/XRMServices/2011/Discovery.svc?wsdl"; service.CrmAuthenticationTokenValue = token; //service.Credentials = System.Net.CredentialCache.DefaultCredentials;
System.Net.NetworkCredential network = new System.Net.NetworkCredential
{
UserName = "username",
Password = "password",
Domain = "domainname"
};// Prepare Query One string fetch1 = @"<fetch mapping='logical'><entity name='account'><attribute name=""ownerid""/> <attribute name=""name""/><attribute name=""new_onholdstatus""/><link-entity name='systemuser' to='owninguser'><attribute name='systemuserid'/><attribute name='domainname' /><attribute name='fullname' /></link-entity></entity></fetch>"; // Fetch the results. ExecuteFetchRequest req = new ExecuteFetchRequest(); req.FetchXml = fetch1; ExecuteFetchResponse result1 = (ExecuteFetchResponse)service.Execute(req);
It is throwing the following error below.
at System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall) at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters) at Microsoft.Crm.SdkTypeProxy.CrmService.Execute(Request Request)
any help would be appreciated, I also need to find how to pass Windows authentication it is normal network login for the on-premise CRM
Mant thanks
Prabir