Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Data;
- using Camelot.SharePointConnector.Data;
- namespace ExampleApplication
- {
- class Program
- {
- static void Main(string[] args)
- {
- var connectionString = @"Server=mysharepointserver.com;User=spuser;Password=******;Database=sitename;Authentication=Ntlm;";
- using (var connection = new SharePointConnection(connectionString))
- {
- try
- {
- Console.WriteLine("Connecting to SharePoint...");
- connection.Open();
- using (var command = new SharePointCommand(@"SELECT ID, Name FROM Employees WHERE Role = 'Developer' ORDER BY ID ASC LIMIT 30", connection))
- {
- using (var reader = command.ExecuteReader())
- {
- while (reader.Read())
- {
- Console.WriteLine(reader["ID"].ToString().PadRight(30) + " : " + reader["Name"].ToString());
- }
- }
- }
- }
- catch (Exception ex)
- {
- Console.WriteLine(ex.ToString());
- }
- Console.WriteLine("Done");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement