Beispiel #1
0
        public static RemoteReservation Create(string serverFQDN, NetworkCredential credentials, Guid mailboxGuid, TenantPartitionHint partitionHint, Guid mdbGuid, ReservationFlags flags)
        {
            RemoteReservation result;

            using (MailboxReplicationProxyClient mailboxReplicationProxyClient = MailboxReplicationProxyClient.CreateWithoutThrottling(serverFQDN, credentials, mailboxGuid, mdbGuid))
            {
                Guid reservationID;
                if (mailboxReplicationProxyClient.ServerVersion[37])
                {
                    byte[] partitionHintBytes = (partitionHint != null) ? partitionHint.GetPersistablePartitionHint() : null;
                    reservationID = ((IMailboxReplicationProxyService)mailboxReplicationProxyClient).IReservationManager_ReserveResources(mailboxGuid, partitionHintBytes, mdbGuid, (int)flags);
                }
                else if (mailboxReplicationProxyClient.ServerVersion[28])
                {
                    reservationID = Guid.NewGuid();
                    LegacyReservationStatus legacyReservationStatus = (LegacyReservationStatus)((IMailboxReplicationProxyService)mailboxReplicationProxyClient).IMailbox_ReserveResources(reservationID, mdbGuid, (int)RemoteReservation.ConvertReservationFlagsToLegacy(flags, true));
                    if (legacyReservationStatus != LegacyReservationStatus.Success)
                    {
                        throw new CapacityExceededReservationException(string.Format("{0}:{1}:{2}", serverFQDN, mdbGuid, flags), 1);
                    }
                }
                else
                {
                    reservationID = RemoteReservation.DownlevelReservationId;
                }
                result = new RemoteReservation(reservationID, serverFQDN, credentials, mailboxGuid, mdbGuid, flags);
            }
            return(result);
        }
        public static byte[] ConvertTenantHint(byte[] originalSignature, MailboxSignatureFlags originalSignatureFlags, TenantPartitionHint tenantHint)
        {
            MailboxSignatureSectionsContainer mailboxSignatureSectionsContainer;

            if (originalSignatureFlags == MailboxSignatureFlags.GetLegacy)
            {
                mailboxSignatureSectionsContainer = MailboxSignatureSectionsContainer.Create(MailboxSignatureSectionType.BasicInformation, new MailboxSignatureConverter.MailboxBasicInformationSectionCreator(originalSignature));
            }
            else
            {
                mailboxSignatureSectionsContainer = MailboxSignatureSectionsContainer.Parse(originalSignature, NullMailboxSignatureSectionProcessor.Instance);
            }
            if (tenantHint == null)
            {
                tenantHint = TenantPartitionHint.FromOrganizationId(OrganizationId.ForestWideOrgId);
            }
            byte[] persistablePartitionHint = tenantHint.GetPersistablePartitionHint();
            int    num = TenantHintHelper.SerializeTenantHint(persistablePartitionHint, null, 0);

            byte[] array = new byte[num];
            TenantHintHelper.SerializeTenantHint(persistablePartitionHint, array, 0);
            mailboxSignatureSectionsContainer.UpdateSection(new MailboxSignatureSectionMetadata(MailboxSignatureSectionType.TenantHint, 1, 1, persistablePartitionHint.Length), array);
            return(mailboxSignatureSectionsContainer.Serialize());
        }
        public MailboxInformation GetMailboxInformation(TransactionalRequestJob requestJob, Guid primaryMailboxGuid, Guid physicalMailboxGuid, TenantPartitionHint partitionHint, Guid targetMdbGuid, string targetMdbName, string remoteHostName, string remoteOrgName, string remoteDCName, NetworkCredential cred)
        {
            MailboxInformation result = null;

            this.CallService(delegate()
            {
                string username = (cred != null) ? cred.UserName : null;
                string password = (cred != null) ? cred.Password : null;
                string domain   = (cred != null) ? cred.Domain : null;
                if (this.ServerVersion[11])
                {
                    string requestJobXml = XMLSerializableBase.Serialize(new RequestJobXML(requestJob), false);
                    result = this.Channel.GetMailboxInformation4(requestJobXml, primaryMailboxGuid, physicalMailboxGuid, (partitionHint != null) ? partitionHint.GetPersistablePartitionHint() : null, targetMdbGuid, targetMdbName, remoteHostName, remoteOrgName, remoteDCName, username, password, domain);
                    return;
                }
                if (this.ServerVersion[4])
                {
                    result = this.Channel.GetMailboxInformation3(primaryMailboxGuid, physicalMailboxGuid, (partitionHint != null) ? partitionHint.GetPersistablePartitionHint() : null, targetMdbGuid, targetMdbName, remoteHostName, remoteOrgName, remoteDCName, username, password, domain);
                    return;
                }
                result = this.Channel.GetMailboxInformation2(primaryMailboxGuid, physicalMailboxGuid, targetMdbGuid, targetMdbName, remoteHostName, remoteOrgName, remoteDCName, username, password, domain);
            });
            return(result);
        }