Advertisement
Guest User

Untitled

a guest
Sep 1st, 2015
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.79 KB | None | 0 0
  1. private CrmService GetCrmService()
  2. {
  3.     // Setup the Authentication Token
  4.     CrmSdk.CrmAuthenticationToken token = new CrmSdk.CrmAuthenticationToken();
  5.     token.OrganizationName = ConfigurationManager.AppSettings["CrmOrg"];
  6.     string crmServerHost = ConfigurationManager.AppSettings["CrmHostName"];
  7.     string crmServerPort = ConfigurationManager.AppSettings["CrmPort"];
  8.     //token.AuthenticationType = 0;
  9.     CrmService service = new CrmService();
  10.     if (crmServerHost != null &&
  11.         crmServerHost.Length > 0)
  12.     {
  13.         service.Url = "http://" + crmServerHost + ":" + crmServerPort + "/MSCRMServices/2007/CrmService.asmx";
  14.     }
  15.     service.Credentials = System.Net.CredentialCache.DefaultCredentials;
  16.     service.CrmAuthenticationTokenValue = token;
  17.  
  18.     return service;
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement