code_junkie

Why do I get 401 errors connecting to the Dynamics CRM Metadata service?

Nov 11th, 2011
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. CrmAuthenticationToken token = new CrmAuthenticationToken();
  2. token.OrganizationName = config.AppSettings.Settings["CrmTargetOrganisation"].Value;
  3. token.AuthenticationType = 0;
  4.  
  5. MetadataService service = new MetadataService();
  6. service.Credentials = System.Net.CredentialCache.DefaultCredentials;
  7. service.Url = config.AppSettings.Settings["CrmMetadataServiceUrl"].Value;
  8. service.CrmAuthenticationTokenValue = token;
  9. service.UnsafeAuthenticatedConnectionSharing = true;
Add Comment
Please, Sign In to add comment