Beispiel #1
0
 public static bool IsUserQualifiedType(ADUser user)
 {
     if (user == null)
     {
         throw new ArgumentNullException("user");
     }
     return(TeamMailboxMembershipHelper.IsUserQualifiedType(user));
 }
Beispiel #2
0
        protected virtual void OnGetUsersComplete(IAsyncResult asyncResult)
        {
            if (asyncResult == null)
            {
                throw new InvalidOperationException("OnGetUsersComplete: asyncResult or the AsynState cannot be null here.");
            }
            if (base.HandleShutDown())
            {
                return;
            }
            Exception ex        = null;
            XmlReader xmlReader = this.EndGetUsers((ICancelableAsyncResult)asyncResult, out ex);

            if (ex != null)
            {
                this.executionAsyncResult.InvokeCallback(ex);
                return;
            }
            List <ADObjectId> list    = new List <ADObjectId>();
            bool          flag        = false;
            Guid          mailboxGuid = this.Job.SyncInfoEntry.MailboxGuid;
            List <string> list2       = new List <string>();
            List <string> list3       = new List <string>();

            try
            {
                using (xmlReader)
                {
                    MembershipSynchronizer.ParseUsers(xmlReader, MembershipSynchronizer.isMultiTenant, out list2, out list3);
                }
            }
            catch (XmlException value)
            {
                this.executionAsyncResult.InvokeCallback(value);
                return;
            }
            foreach (string text in list2)
            {
                try
                {
                    Exception  ex2;
                    ADRawEntry adrawEntry = TeamMailboxNameIdResolver.Resolve(this.recipientSession, text, out ex2);
                    if (ex2 != null)
                    {
                        ProtocolLog.LogError(this.loggingComponent, this.loggingContext, string.Format("MembershipSynchronizer.OnGetUsersComplete: Skip the update for user {0} because we failed to resolve it", text), ex2);
                    }
                    else if (adrawEntry != null)
                    {
                        if (TeamMailboxMembershipHelper.IsUserQualifiedType(adrawEntry))
                        {
                            if (this.newOwners.Count + list.Count >= 1800)
                            {
                                flag = true;
                                break;
                            }
                            list.Add(adrawEntry.Id);
                        }
                        else
                        {
                            ProtocolLog.LogStatistics(this.loggingComponent, this.loggingContext, string.Format("MembershipSynchronizer.OnGetUsersComplete: Drop unqualified owner {0} for team mailbox {1}", adrawEntry.Id, mailboxGuid));
                        }
                    }
                }
                catch (NonUniqueRecipientException exception)
                {
                    ProtocolLog.LogError(this.loggingComponent, this.loggingContext, string.Format("MembershipSynchronizer.OnGetUsersComplete: Skip the update for user {0} because of NonUniqueRecipientException", text), exception);
                }
            }
            if (!this.doneDownloadingOwners)
            {
                this.newOwners             = list;
                this.doneDownloadingOwners = true;
                this.BeginDownloadUsers(new AsyncCallback(this.OnGetUsersComplete), false);
                return;
            }
            this.newMembers = list;
            if (flag)
            {
                ProtocolLog.LogError(this.loggingComponent, this.loggingContext, string.Format("MembershipSynchronizer.OnGetUsersComplete: the total user count is more than TotalOwnersAndMembersLimit ({0}), updated {1} users only for team mailbox {2}.", 1800, 1800, mailboxGuid), new NotSupportedException());
            }
            Exception value2 = this.ProcessNewOwnersAndMembers(mailboxGuid, this.newOwners, this.newMembers);

            this.executionAsyncResult.InvokeCallback(value2);
        }