private ADRawEntry[] GetMemberRawEntriesFromAD(IRecipientSession recipientSession, ADUser groupAdUser)
 {
     ADRawEntry[] result;
     try
     {
         result = UnifiedGroupADAccessLayer.GetAllGroupMembers(recipientSession, groupAdUser.Id, IdentityDetails.Properties, new SortBy(ADRecipientSchema.DisplayName, SortOrder.Ascending), null, 0).ReadAllPages();
     }
     catch (LocalizedException ex)
     {
         base.WriteWarning("Unable to retrieve members details from directory due exception: " + ex.Message);
         result = new ADRawEntry[0];
     }
     return(result);
 }
Exemple #2
0
 private void UpdateMembershipInAD(ADUser groupADUser, ADUser[] addedMembers, ADUser[] removedMembers)
 {
     try
     {
         this.AddVerboseLog("Start: UpdateMembers in AD");
         using (new StopwatchPerformanceTracker("GroupMailboxContext.UpdateMembersInAD", GenericCmdletInfoDataLogger.Instance))
         {
             UnifiedGroupADAccessLayer unifiedGroupADAccessLayer = new UnifiedGroupADAccessLayer(groupADUser, this.adSession.DomainController);
             unifiedGroupADAccessLayer.UpdateMembership(addedMembers, removedMembers);
         }
     }
     finally
     {
         this.AddVerboseLog("End: UpdateMembers in AD");
     }
 }
        protected override FindMembersInUnifiedGroupResponse InternalExecute()
        {
            FindMembersInUnifiedGroupResponse findMembersInUnifiedGroupResponse = new FindMembersInUnifiedGroupResponse();
            ADRecipient adrecipient = base.CallContext.ADRecipientSessionContext.GetADRecipientSession().FindByProxyAddress(this.request.ProxyAddress);
            ADUser      aduser      = adrecipient as ADUser;

            if (adrecipient == null)
            {
                throw new InvalidCastException("Expected a recipient of ADUser type");
            }
            UnifiedGroupADAccessLayer unifiedGroupADAccessLayer = new UnifiedGroupADAccessLayer(aduser, aduser.OriginatingServer);

            if (this.request.Filter != null)
            {
                IEnumerable <UnifiedGroupParticipant> membersByAnrMatch = unifiedGroupADAccessLayer.GetMembersByAnrMatch(this.request.Filter.Trim().ToLower(), true, 101);
                ModernGroupMemberType[] array = this.ConvertListToMemberTypeArray(membersByAnrMatch);
                findMembersInUnifiedGroupResponse.HasMoreMembers = (array.Length > 100);
                Array.Resize <ModernGroupMemberType>(ref array, Math.Min(array.Length, 100));
                findMembersInUnifiedGroupResponse.Members = array;
            }
            return(findMembersInUnifiedGroupResponse);
        }