Exemplo n.º 1
0
 private void WriteMembersToGroupIfRequired(MailboxSession mailboxSession)
 {
     if (this.addedMembers == null && this.removedMembers == null)
     {
         return;
     }
     GroupMailboxAccessLayer.Execute("UpdateGroupMailboxViaXSO.WriteMembersToGroupIfRequired", this.adSession, mailboxSession, delegate(GroupMailboxAccessLayer accessLayer)
     {
         GroupMailboxLocator group = GroupMailboxLocator.Instantiate(this.adSession, this.group);
         accessLayer.SetMembershipState(this.executingUser, this.addedMembers, this.removedMembers, group);
     });
 }
Exemplo n.º 2
0
        protected virtual List <string> GetEscalatedUsersList(IMailboxSession session, out string yammerEscalateAddress)
        {
            ProxyAddress proxyAddress = ProxyAddress.Parse(session.MailboxOwner.MailboxInfo.PrimarySmtpAddress.ToString());

            if (proxyAddress is InvalidProxyAddress)
            {
                GroupEscalation.Tracer.TraceError <string>((long)this.GetHashCode(), "GroupEscalation.GetEscalatedUsersList: Escalation failed. Could not parse smtp address: {0}", session.MailboxOwner.MailboxInfo.PrimarySmtpAddress.ToString());
                yammerEscalateAddress = string.Empty;
                return(new List <string>());
            }
            GroupMailboxLocator groupMailboxLocator = GroupMailboxLocator.Instantiate(session.GetADRecipientSession(true, ConsistencyMode.IgnoreInvalid), proxyAddress);

            yammerEscalateAddress = groupMailboxLocator.GetYammerGroupAddress();
            EscalationGetter escalationGetter = new EscalationGetter(groupMailboxLocator, session);

            return(escalationGetter.Execute());
        }
Exemplo n.º 3
0
        private ADRawEntry[] GetMemberRawEntriesFromMailbox(IRecipientSession recipientSession, ADUser adUser, MailboxSession mailboxSession)
        {
            GroupMailboxLocator groupLocator      = GroupMailboxLocator.Instantiate(recipientSession, adUser);
            List <string>       exchangeLegacyDNs = new List <string>(10);

            GroupMailboxAccessLayer.Execute("Get-GroupMailbox", recipientSession, mailboxSession, delegate(GroupMailboxAccessLayer accessLayer)
            {
                IEnumerable <UserMailbox> members = accessLayer.GetMembers(groupLocator, false, null);
                foreach (UserMailbox userMailbox in members)
                {
                    exchangeLegacyDNs.Add(userMailbox.Locator.LegacyDn);
                }
            });
            string[]          array = exchangeLegacyDNs.ToArray();
            List <ADRawEntry> list  = new List <ADRawEntry>(array.Length);

            try
            {
                Result <ADRawEntry>[] array2 = recipientSession.FindByExchangeLegacyDNs(array, IdentityDetails.Properties);
                for (int i = 0; i < array2.Length; i++)
                {
                    Result <ADRawEntry> result = array2[i];
                    if (result.Error != null)
                    {
                        this.WriteWarning(Strings.WarningUnableToResolveUser(array[i].ToString(), result.Error.ToString()));
                    }
                    else if (result.Data == null)
                    {
                        base.WriteVerbose(Strings.WarningUnableToResolveUser(array[i].ToString(), string.Empty));
                    }
                    else
                    {
                        list.Add(result.Data);
                    }
                }
            }
            catch (LocalizedException ex)
            {
                base.WriteWarning("Unable to retrieve members details from mailbox due exception: " + ex.Message);
            }
            return(list.ToArray());
        }
        // Token: 0x06001535 RID: 5429 RVA: 0x000792F8 File Offset: 0x000774F8
        private void ReplicateOutOfSyncAssociations(MailboxSession mailboxSession, ADUser masterAdUser, IRecipientSession adSession, GroupMailboxAccessLayer accessLayer)
        {
            mailboxSession.Mailbox.GetValueOrDefault <MailboxAssociationProcessingFlags>(MailboxSchema.MailboxAssociationProcessingFlags, MailboxAssociationProcessingFlags.None);
            if (masterAdUser.RecipientTypeDetails == RecipientTypeDetails.GroupMailbox)
            {
                MailboxAssociationReplicationAssistant.Tracer.TraceDebug((long)this.GetHashCode(), "Replicating associations for GroupMailbox via MailboxAssistant WorkCycle");
                GroupMailboxLocator masterLocator = GroupMailboxLocator.Instantiate(adSession, masterAdUser);
                accessLayer.ReplicateOutOfSyncAssociation(masterLocator);
                return;
            }
            if (masterAdUser.RecipientTypeDetails == RecipientTypeDetails.UserMailbox)
            {
                MailboxAssociationReplicationAssistant.Tracer.TraceDebug((long)this.GetHashCode(), "Replicating associations for UserMailbox via MailboxAssistant WorkCycle");
                UserMailboxLocator masterLocator2 = UserMailboxLocator.Instantiate(adSession, masterAdUser);
                accessLayer.ReplicateOutOfSyncAssociation(masterLocator2);
                return;
            }
            string message = string.Format("Replication of Mailbox Associations is not yet supported for mailbox of type {0}", masterAdUser.RecipientTypeDetails);

            MailboxAssociationReplicationAssistant.Tracer.TraceError((long)this.GetHashCode(), message);
            throw new NotImplementedException(message);
        }
Exemplo n.º 5
0
        private List <string> CalculateTargetUsers(ADUser adUser, IRecipientSession adSession, StoreSession session)
        {
            GroupMailboxLocator groupMailboxLocator = GroupMailboxLocator.Instantiate(adSession, new SmtpProxyAddress(session.MailboxOwner.MailboxInfo.PrimarySmtpAddress.ToString(), true));
            ADUser aduser = adUser ?? groupMailboxLocator.FindAdUser();

            if (aduser == null)
            {
                return(new List <string>());
            }
            List <string>    groupPinners = this.GetGroupPinners(session, groupMailboxLocator);
            List <string>    groupOwners  = this.GetGroupOwners(aduser);
            HashSet <string> hashSet      = new HashSet <string>(groupPinners);

            foreach (string item in groupOwners)
            {
                hashSet.Add(item);
            }
            if (hashSet.Count != 0)
            {
                List <string> groupSubscribers = this.GetGroupSubscribers(session, groupMailboxLocator);
                foreach (string item2 in groupSubscribers)
                {
                    hashSet.Remove(item2);
                }
                List <string> list = new List <string>();
                foreach (string text in hashSet)
                {
                    if (!this.IsUserFlighted(adSession, text))
                    {
                        list.Add(text);
                    }
                }
                foreach (string item3 in list)
                {
                    hashSet.Remove(item3);
                }
            }
            return(hashSet.ToList <string>());
        }
        // Token: 0x06001536 RID: 5430 RVA: 0x000793B0 File Offset: 0x000775B0
        private void ReplicateAssociations(ADUser masterAdUser, IRecipientSession adSession, ICollection <IMailboxLocator> itemsToReplicate, GroupMailboxAccessLayer accessLayer)
        {
            if (masterAdUser.RecipientTypeDetails == RecipientTypeDetails.GroupMailbox)
            {
                MailboxAssociationReplicationAssistant.Tracer.TraceDebug((long)this.GetHashCode(), "Replicating associations for GroupMailbox via MailboxAssistant.RunNow");
                GroupMailboxLocator  masterLocator = GroupMailboxLocator.Instantiate(adSession, masterAdUser);
                UserMailboxLocator[] slaveLocators = itemsToReplicate.Cast <UserMailboxLocator>().ToArray <UserMailboxLocator>();
                accessLayer.ReplicateOutOfSyncAssociation(masterLocator, slaveLocators);
                return;
            }
            if (masterAdUser.RecipientTypeDetails == RecipientTypeDetails.UserMailbox)
            {
                MailboxAssociationReplicationAssistant.Tracer.TraceDebug((long)this.GetHashCode(), "Replicating associations for UserMailbox via MailboxAssistant.RunNow");
                UserMailboxLocator    masterLocator2 = UserMailboxLocator.Instantiate(adSession, masterAdUser);
                GroupMailboxLocator[] slaveLocators2 = itemsToReplicate.Cast <GroupMailboxLocator>().ToArray <GroupMailboxLocator>();
                accessLayer.ReplicateOutOfSyncAssociation(masterLocator2, slaveLocators2);
                return;
            }
            string message = string.Format("Replication of Mailbox Associations is not yet supported for mailbox of type {0}", masterAdUser.RecipientTypeDetails);

            MailboxAssociationReplicationAssistant.Tracer.TraceError((long)this.GetHashCode(), message);
            throw new NotImplementedException(message);
        }
Exemplo n.º 7
0
        internal string[] GetMembers(ADUser groupMailbox, IRecipientSession recipientSession, string operation)
        {
            List <string> externalDirectoryObjectIds = new List <string>(10);

            this.WriteVerbose("Getting members from group mailbox: {0}", new object[]
            {
                groupMailbox.Id
            });
            using (MailboxSession mailboxSession = MailboxSession.OpenAsAdmin(ExchangePrincipal.FromADUser(groupMailbox, RemotingOptions.AllowCrossSite), CultureInfo.InvariantCulture, "Client=Management;Action=" + operation))
            {
                GroupMailboxAccessLayer.Execute(operation, recipientSession, mailboxSession, delegate(GroupMailboxAccessLayer accessLayer)
                {
                    GroupMailboxLocator group         = GroupMailboxLocator.Instantiate(recipientSession, groupMailbox);
                    IEnumerable <UserMailbox> members = accessLayer.GetMembers(group, false, null);
                    foreach (UserMailbox userMailbox in members)
                    {
                        if (string.IsNullOrEmpty(userMailbox.Locator.ExternalId))
                        {
                            this.WriteVerbose("Group member is missing ExternalId: {0}", new object[]
                            {
                                userMailbox.Locator.LegacyDn
                            });
                        }
                        else
                        {
                            externalDirectoryObjectIds.Add(userMailbox.Locator.ExternalId);
                            this.WriteVerbose("Group member: {0}, ExternalDirectoryObjectId={1}", new object[]
                            {
                                userMailbox.Locator.LegacyDn,
                                userMailbox.Locator.ExternalId
                            });
                        }
                    }
                });
            }
            return(externalDirectoryObjectIds.ToArray());
        }
Exemplo n.º 8
0
 public override MailboxLocator CreateMasterLocator()
 {
     return(GroupMailboxLocator.Instantiate(base.AdSession, base.CurrentMailbox));
 }