How to get all the SharePoint 2013 Site Groups using C# Client Side Object Model
- I am using VS 2013 on my laptop and SP 2013 is on the network
I read that I have to use Credentials or equivalent but dont know how
namespace ConsoleApplication5 { class Program { static void Main(string[] args) { // ClientContext - Get the context for the SharePoint Site // SharePoint site URL - http://servername/sites/CSOM ClientContext clientContext = new ClientContext("http://sp2013/"); // Get the SharePoint web Web web = clientContext.Web; // Get all the site groups GroupCollection groupColl = web.SiteGroups; clientContext.Load(groupColl); // Execute the query to the server clientContext.ExecuteQuery(); foreach (Group group in groupColl) { // Display the group name Console.WriteLine(group.Title); } Console.ReadLine(); } } }