Created
          May 26, 2012 07:43 
        
      - 
      
- 
        Save olegwtf/2792796 to your computer and use it in GitHub Desktop. 
    Microsoft Sharepoint Authentication
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | namespace ConsoleApplication1 | |
| { | |
| class Program | |
| { | |
| static void Main(string[] args) | |
| { | |
| ClientContext clientContext = new ClientContext("http://sitename"); | |
| CredentialCache cc = new CredentialCache(); | |
| cc.Add(new Uri("http://sitename"), "NTLM", new NetworkCredential("User", "Password")); | |
| clientContext.Credentials = cc; | |
| clientContext.AuthenticationMode = ClientAuthenticationMode.Default; | |
| Web site = clientContext.Web; | |
| clientContext.Load(site); | |
| clientContext.ExecuteQuery(); | |
| Console.WriteLine("Title: {0}", site.Title); | |
| Console.ReadKey(); | |
| } | |
| } | |
| } | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment