Quantcast
Viewing all articles
Browse latest Browse all 8223

How to Fetch Data from Dynamic CRM 2011 using web service and c#: On-premise?

I am trying to fetch data from MS dynamic CRM 2011 on following environment

  1. Dynamic CRM 2011 On-premise using Windows authentication.
  2. Microsoft.crm.sdk.dll and microsoft.crm.sdktypeproxy.dll references.
  3. C# .NET Windows Form visual studio 2012

I have been getting the following MSDN resources.

  1. http://msdn.microsoft.com/en-us/library/bb959412.aspx

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






Viewing all articles
Browse latest Browse all 8223

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>