private static string GetTenantId(IStoreSession session) { string result = string.Empty; byte[] valueOrDefault = session.Mailbox.GetValueOrDefault <byte[]>(MailboxSchema.PersistableTenantPartitionHint, null); if (valueOrDefault != null && valueOrDefault.Length > 0) { TenantPartitionHint tenantPartitionHint = TenantPartitionHint.FromPersistablePartitionHint(valueOrDefault); Guid externalDirectoryOrganizationId = tenantPartitionHint.GetExternalDirectoryOrganizationId(); result = (Guid.Empty.Equals(externalDirectoryOrganizationId) ? string.Empty : externalDirectoryOrganizationId.ToString()); } return(result); }
public static TenantPartitionHintAdapter FromPartitionHint(TenantPartitionHint partitionHint) { return(new TenantPartitionHintAdapter(partitionHint.GetExternalDirectoryOrganizationId(), partitionHint.IsConsumer())); }
// Token: 0x06001574 RID: 5492 RVA: 0x00079F5C File Offset: 0x0007815C public static IRecipientSession GetAdRecipientSession(TenantPartitionHint tenantPartitionHint) { Guid externalDirectoryOrganizationId = (tenantPartitionHint != null) ? tenantPartitionHint.GetExternalDirectoryOrganizationId() : TenantPartitionHint.ExternalDirectoryOrganizationIdForRootOrg; return(ADHelper.GetAdRecipientSession(externalDirectoryOrganizationId)); }
public static ReservationBase CreateReservation(Guid mailboxGuid, TenantPartitionHint partitionHint, Guid resourceId, ReservationFlags flags, string clientName) { ReservationBase result; using (DisposeGuard disposeGuard = default(DisposeGuard)) { SettingsContextBase settingsContextBase = new MailboxSettingsContext(mailboxGuid, null); if (partitionHint != null) { settingsContextBase = new OrganizationSettingsContext(OrganizationId.FromExternalDirectoryOrganizationId(partitionHint.GetExternalDirectoryOrganizationId()), settingsContextBase); } ReservationBase reservationBase; if (resourceId == MRSResource.Id.ObjectGuid) { reservationBase = new MRSReservation(); } else { if (flags.HasFlag(ReservationFlags.Read)) { reservationBase = new ReadReservation(); } else { reservationBase = new WriteReservation(); } settingsContextBase = new DatabaseSettingsContext(resourceId, settingsContextBase); } disposeGuard.Add <ReservationBase>(reservationBase); settingsContextBase = new GenericSettingsContext("WorkloadType", reservationBase.WorkloadType.ToString(), settingsContextBase); reservationBase.MailboxGuid = mailboxGuid; reservationBase.PartitionHint = partitionHint; reservationBase.ResourceId = resourceId; reservationBase.Flags = flags; reservationBase.ClientName = clientName; using (settingsContextBase.Activate()) { reservationBase.ReserveResources(); } disposeGuard.Success(); result = reservationBase; } return(result); }