Advertisement
Guest User

Untitled

a guest
Aug 9th, 2016
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.31 KB | None | 0 0
  1. using System;
  2. using System.Data;
  3. using Camelot.SharePointConnector.Data;
  4.  
  5. namespace ExampleApplication
  6. {
  7. class Program
  8. {
  9. static void Main(string[] args)
  10. {
  11. var connectionString = @"Server=mysharepointserver.com;User=spuser;Password=******;Database=sitename;Authentication=Ntlm;";
  12. using (var connection = new SharePointConnection(connectionString))
  13. {
  14. try
  15. {
  16. Console.WriteLine("Connecting to SharePoint...");
  17. connection.Open();
  18.  
  19. using (var command = new SharePointCommand(@"SELECT ID, Name FROM Employees WHERE Role = 'Developer' ORDER BY ID ASC LIMIT 30", connection))
  20. {
  21. using (var reader = command.ExecuteReader())
  22. {
  23. while (reader.Read())
  24. {
  25. Console.WriteLine(reader["ID"].ToString().PadRight(30) + " : " + reader["Name"].ToString());
  26. }
  27. }
  28. }
  29. }
  30. catch (Exception ex)
  31. {
  32. Console.WriteLine(ex.ToString());
  33. }
  34. Console.WriteLine("Done");
  35. }
  36. }
  37. }
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement