Example #1
0
        static void RetrieveUpdatedGroup(string groupName)
        {
            List<IGroup> foundGroups = null;
            try
            {
                foundGroups = activeDirectoryClient.Groups.Where(group =>group.DisplayName.Equals(groupName)).ExecuteAsync().Result.CurrentPage.ToList();
            }
            catch (Exception e)
            {
                Console.WriteLine("\nError getting Group {0} {1}", e.Message, e.InnerException != null ? e.InnerException.Message : "");
            }
            if (foundGroups != null && foundGroups.Count > 0)
            {
                foreach (IGroup group in foundGroups)
                {
                    //Console.WriteLine("Group Name: {0}   GroupObjectId: {1}", group.DisplayName, group.ObjectId);

                    var newGroup = new GroupEntity(group.ObjectId, group.DisplayName);
                    newGroup.Descrption = group.Description;
                    newGroup.SecurityEnabled = (bool)group.SecurityEnabled;
                    newGroup.MailNickName = group.MailNickname;
                    newGroup.OriginatedFrom = "AAD";
                    groupTableOper.InsertEntity(newGroup);
                }
            }
        }
Example #2
0
 public bool InsertEntity(GroupEntity group)
 {
     var operation = TableOperation.InsertOrReplace(group);
     _table.Execute(operation);
     return true;
 }