Microsoft CRM 4.0 web services 401 unauthorized

This question is not answered
am having issues adding new records to the CRM using Microsoft web service. I keep getting the 401 unauthorized.  Any idea on how CRM handles priviledges through web services will be useful.    Sample error message----------------------------------Unable to Create new RecordSystem.Net.WebException: The request failed with HTTP status 401: Unauthorized.   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 CRM.Proxy.CrmSdk.CrmService.Create(BusinessEntity entity)   at TestCRMConsole.Program.Main(String[] args) in E:\RCICODES\RCIStageCodes\TestCRMConsole\TestCRMConsole\Program.cs:line 42  sample code used-----------------------------------static void Main(string[] args)        {                                     CrmAuthenticationToken token = new CrmAuthenticationToken();                token.AuthenticationType = 0;                token.OrganizationName = "Together";                                           CrmService service = new CrmService();                service.Url = "http://rci-lab-crm/mscrmservices/2007/CrmService.asmx";                               //service.Credentials = System.Net.CredentialCache.DefaultCredentials;                              service.CrmAuthenticationTokenValue = token;                service.Credentials = new System.Net.NetworkCredential("XXX", "XXXX", "together");                 contact SampleContact = new contact();                SampleContact.firstname = "John";                SampleContact.lastname = "Doe";                SampleContact.telephone1 = "561-";                SampleContact.emailaddress1 = "Emailprotected";             try            {                service.Create(SampleContact);            }            catch (Exception Ex)            {                Console.WriteLine("Unable to Create new Record" + Ex);            }                       Console.WriteLine("WAIT");            Console.Read();        }


All Replies
  • i have the same problem as well...

    can someone please give any solution???