Retrieve users and groups from Active Directory (AD)

Below code describes how to get all users and all groups from active directory (AD Server) Using System.DirectoryServices Steps:- Add System.Directoryservices.dll and System.Directoryservices.AccountManagement.dll which provides access to active directory. Using System.DirectoryServices.AccountManagement I have used a generic list (collection of string) to store account name of user and group.   class Program { static void Main(string[] args) {  List<string> _userOrGroupColl = […]

Add default site columns to list using Client Object Model

Below code describes how to add site columns from site to SharePoint list. Add reference “Microsoft.sharepoint.client.dll” and “Microsoft.sharepoint.client.Runtime.dll”. Write Below Code. class Program { static void Main(string[] args) { string listName = “New List”; using (ClientContext context = new ClientContext(“siteUrl”)) { context.Credentials = new System.Net.NetworkCredential(“UserName”, “Password”); //Apply Credential Web web = context.Web; context.Load(web, w => w.AvailableFields, w => w.Lists); List […]