private StoreMailboxIdParameter(string identity) { this.rawIdentity = identity; if (string.IsNullOrEmpty(identity)) { throw new ArgumentNullException("identity"); } MailboxId mailboxId = null; try { mailboxId = new MailboxId(null, new Guid(identity)); } catch (FormatException) { } catch (ArgumentOutOfRangeException) { } if (null == mailboxId && CultureInfo.InvariantCulture.CompareInfo.IsPrefix(identity, "/o=", CompareOptions.IgnoreCase)) { mailboxId = new MailboxId(identity); } if (null != mailboxId) { this.Initialize(mailboxId); } this.displayName = identity; }
private static void SaveArchiveSecurityDescriptor(ADUser mailbox, IConfigDataProvider writableAdSession, RawSecurityDescriptor rawSd, Task.TaskVerboseLoggingDelegate logVerbose, Task.ErrorLoggerDelegate logError) { ADObjectId adobjectId = mailbox.ArchiveDatabase ?? mailbox.Database; MailboxId mailboxId = new MailboxId(MapiTaskHelper.ConvertDatabaseADObjectIdToDatabaseId(adobjectId), mailbox.ArchiveGuid); try { ActiveManager activeManagerInstance = ActiveManager.GetActiveManagerInstance(); DatabaseLocationInfo serverForDatabase = activeManagerInstance.GetServerForDatabase(adobjectId.ObjectGuid); using (MapiMessageStoreSession mapiMessageStoreSession = new MapiMessageStoreSession(serverForDatabase.ServerLegacyDN, PermissionTaskHelper.CalcuteSystemAttendantMailboxLegacyDistingushName(serverForDatabase.ServerLegacyDN), Fqdn.Parse(serverForDatabase.ServerFqdn))) { logVerbose(Strings.VerboseSaveStoreMailboxSecurityDescriptor(mailboxId.ToString(), mapiMessageStoreSession.ServerName)); mapiMessageStoreSession.ForceStoreToRefreshMailbox(mailboxId); } } catch (FormatException) { logError(new TaskInvalidOperationException(Strings.ErrorInvalidServerLegacyDistinguishName(mailbox.DistinguishedName.ToString())), ExchangeErrorCategory.ServerOperation, null); } catch (Microsoft.Exchange.Data.Mapi.Common.MailboxNotFoundException) { logVerbose(Strings.VerboseArchiveNotExistInStore(mailbox.Name)); PermissionTaskHelper.SaveAdSecurityDescriptor(mailbox, writableAdSession, rawSd, logVerbose, logError); } catch (LocalizedException exception) { logError(new SetArchivePermissionException(mailbox.Name, exception), ExchangeErrorCategory.ServerOperation, null); } }
internal static bool CheckFullAccessPermissions(ADUser executingAdUser, ADUser accessRequestedForADUser, IRecipientSession session) { ExTraceGlobals.TaskTracer.TraceDebug <string, string>(0L, "Checking if {0} has full access for mailbox {1}", executingAdUser.Alias, accessRequestedForADUser.Alias); ActiveManager activeManagerInstance = ActiveManager.GetActiveManagerInstance(); DatabaseLocationInfo serverForDatabase = activeManagerInstance.GetServerForDatabase(accessRequestedForADUser.Database.ObjectGuid); RawSecurityDescriptor rawSecurityDescriptor = null; using (MapiMessageStoreSession mapiMessageStoreSession = new MapiMessageStoreSession(serverForDatabase.ServerLegacyDN, Server.GetSystemAttendantLegacyDN(serverForDatabase.ServerLegacyDN), Fqdn.Parse(serverForDatabase.ServerFqdn))) { MailboxId mailboxId = new MailboxId(new DatabaseId(accessRequestedForADUser.Database.ObjectGuid), accessRequestedForADUser.ExchangeGuid); try { rawSecurityDescriptor = mapiMessageStoreSession.GetMailboxSecurityDescriptor(mailboxId); } catch (MailboxNotFoundException) { ExTraceGlobals.TaskTracer.TraceDebug <MailboxId>(0L, "Could not find mailbox {0} when attempting to read its security descriptor.", mailboxId); return(false); } } byte[] array = new byte[rawSecurityDescriptor.BinaryLength]; rawSecurityDescriptor.GetBinaryForm(array, 0); ActiveDirectorySecurity activeDirectorySecurity = new ActiveDirectorySecurity(); activeDirectorySecurity.SetSecurityDescriptorBinaryForm(array); int num = AuthzAuthorization.CheckGenericPermission(executingAdUser.Sid, rawSecurityDescriptor, AccessMask.CreateChild); return((num & 1) == 1); }
// Token: 0x0600003D RID: 61 RVA: 0x00002F64 File Offset: 0x00001164 protected virtual void CreateMigrationBatch(MailboxId migrationMailbox, byte[] csvFile) { for (int i = 0; i < 3; i++) { try { using (AnchorRunspaceProxy anchorRunspaceProxy = AnchorRunspaceProxy.CreateRunspaceForDatacenterAdmin(base.Context, base.Context.ApplicationName)) { PSCommand pscommand = new PSCommand(); pscommand.AddCommand("New-MigrationBatch"); pscommand.AddParameter("XO1", true); pscommand.AddParameter("CSVData", csvFile); pscommand.AddParameter("Partition", migrationMailbox); anchorRunspaceProxy.RunPSCommand <PSObject>(pscommand); } base.Context.Logger.Log(MigrationEventType.Information, "Successfully created new migration batch against {0}", new object[] { migrationMailbox }); break; } catch (InvalidRunspaceStateException ex) { base.Context.Logger.Log(MigrationEventType.Error, "PS Runspace was closed so command could not be run : {0}", new object[] { ex }); } } }
public static void Convert(DataRow dataRow) { foreach (object obj in dataRow.Table.Columns) { DataColumn dataColumn = (DataColumn)obj; Type type = dataColumn.ExtendedProperties["ExpectedType"] as Type; string text = dataRow[dataColumn] as string; if (type != null && dataRow[dataColumn].GetType() != type && text != null) { if (type == typeof(Unlimited <int>)) { dataRow[dataColumn] = Unlimited <int> .Parse(text); } else if (type == typeof(Unlimited <EnhancedTimeSpan>)) { dataRow[dataColumn] = Unlimited <EnhancedTimeSpan> .Parse(text); } else if (type == typeof(EmailAddressPolicyPriority)) { dataRow[dataColumn] = EmailAddressPolicyPriority.Parse(text); } else if (type == typeof(SmtpDomainWithSubdomains)) { dataRow[dataColumn] = SmtpDomainWithSubdomains.Parse(text); } else if (type == typeof(SmtpAddress)) { dataRow[dataColumn] = SmtpAddress.Parse(text); } else if (type == typeof(ProxyAddress)) { dataRow[dataColumn] = ProxyAddress.Parse(text); } else if (type == typeof(MailboxId)) { dataRow[dataColumn] = MailboxId.Parse(text); } else if (type == typeof(UMLanguage)) { dataRow[dataColumn] = UMLanguage.Parse(text); } else { if (!(type == typeof(ExchangeObjectVersion))) { throw new ArgumentException(string.Format("Type {0} is not supported convert from string yet", type)); } Regex regex = new Regex("^(?<Major>\\d+)\\.(?<Minor>\\d+) \\((?<buildMajor>\\d+)\\.(?<buildMinor>\\d+)\\.(?<buildVersion>\\d+)\\.(?<buildRevison>\\d+)\\)$"); Match match = regex.Match(text); if (!match.Success) { throw new ArgumentException(string.Format("{0} is not a valid ExchangeObjectVersion", text)); } dataRow[dataColumn] = new ExchangeObjectVersion(byte.Parse(match.Result("${Major}")), byte.Parse(match.Result("${Minor}")), byte.Parse(match.Result("${buildMajor}")), byte.Parse(match.Result("${buildMinor}")), ushort.Parse(match.Result("${buildVersion}")), ushort.Parse(match.Result("${buildRevison}"))); } } } }
internal static void CheckLegacyDNNotInUse(MailboxId disconnectedMailboxIdentity, string disconnectedMailboxLegacyDN, IRecipientSession globalCatalogSession, Task.ErrorLoggerDelegate errorLogger) { ADRecipient adrecipient = ConnectMailbox.FindMailboxByLegacyDN(disconnectedMailboxLegacyDN, globalCatalogSession); if (adrecipient != null) { errorLogger(new MdbAdminTaskException(Strings.ErrorMailboxLegacyDNInUse(disconnectedMailboxLegacyDN, disconnectedMailboxIdentity.ToString(), adrecipient.DisplayName)), ExchangeErrorCategory.ServerOperation, disconnectedMailboxIdentity); } }
public static ObjectId RedactMailboxId(ObjectId mailboxId, out string raw, out string redacted) { raw = null; redacted = null; if (mailboxId is MailboxId) { mailboxId = new MailboxId(SuppressingPiiData.RedactLegacyDN(((MailboxId)mailboxId).MailboxExchangeLegacyDn, out raw, out redacted)); } return(mailboxId); }
public override int GetHashCode() { return(PrimaryFolder.GetHashCode() ^ Unread.GetHashCode() ^ Attachments.GetHashCode() ^ PeriodFrom.GetHashCode() ^ PeriodTo.GetHashCode() ^ Important.GetHashCode() ^ FromAddress.GetHashCode() ^ MailboxId.GetHashCode() ^ CustomLabels.GetHashCode() ^ Sort.GetHashCode() ^ SortOrder.GetHashCode() ^ SearchText.GetHashCode() ^ Page.GetValueOrDefault() ^ PageSize.GetHashCode() ^ SetLabel.GetHashCode() ^ WithCalendar.GetHashCode() ^ UserFolderId.GetHashCode() ^ FromDate.GetHashCode() ^ FromMessage.GetHashCode() ^ PrevFlag.GetHashCode()); }
public override string ToString() { MailboxId mailboxId = base.MapiObjectId as MailboxId; if (null != mailboxId) { return(mailboxId.ToString()); } if (!string.IsNullOrEmpty(this.displayName)) { return(this.displayName); } return(string.Empty); }
public static void SaveMailboxSecurityDescriptor(ADUser mailbox, ActiveDirectorySecurity adSecurity, IConfigDataProvider writableAdSession, ref MapiMessageStoreSession storeSession, Task.TaskVerboseLoggingDelegate logVerbose, Task.ErrorLoggerDelegate logError) { if (writableAdSession == null) { throw new ArgumentException("writableAdSession"); } RawSecurityDescriptor rawSd = new RawSecurityDescriptor(adSecurity.GetSecurityDescriptorBinaryForm(), 0); PermissionTaskHelper.SaveAdSecurityDescriptor(mailbox, writableAdSession, rawSd, logVerbose, logError); string text = null; try { ActiveManager activeManagerInstance = ActiveManager.GetActiveManagerInstance(); DatabaseLocationInfo serverForDatabase = activeManagerInstance.GetServerForDatabase(mailbox.Database.ObjectGuid); text = serverForDatabase.ServerFqdn; if (storeSession == null) { storeSession = new MapiMessageStoreSession(serverForDatabase.ServerLegacyDN, PermissionTaskHelper.CalcuteSystemAttendantMailboxLegacyDistingushName(serverForDatabase.ServerLegacyDN), Fqdn.Parse(serverForDatabase.ServerFqdn)); } else { storeSession.RedirectServer(serverForDatabase.ServerLegacyDN, Fqdn.Parse(serverForDatabase.ServerFqdn)); } MailboxId mailboxId = new MailboxId(MapiTaskHelper.ConvertDatabaseADObjectIdToDatabaseId(mailbox.Database), mailbox.ExchangeGuid); logVerbose(Strings.VerboseSaveStoreMailboxSecurityDescriptor(mailboxId.ToString(), storeSession.ServerName)); storeSession.Administration.PurgeCachedMailboxObject(mailboxId.MailboxGuid); } catch (DatabaseNotFoundException) { logVerbose(Strings.ErrorMailboxDatabaseNotFound(mailbox.Database.ToString())); } catch (MapiExceptionNetworkError) { logVerbose(Strings.ErrorFailedToConnectToStore((text != null) ? text : string.Empty)); } catch (FormatException) { logVerbose(Strings.ErrorInvalidServerLegacyDistinguishName(mailbox.DistinguishedName.ToString())); } catch (Microsoft.Exchange.Data.Mapi.Common.MailboxNotFoundException) { logVerbose(Strings.VerboseMailboxNotExistInStore(mailbox.DistinguishedName)); } if (mailbox.HasLocalArchive) { PermissionTaskHelper.SaveArchiveSecurityDescriptor(mailbox, writableAdSession, rawSd, logVerbose, logError); } }
// Token: 0x06001A9A RID: 6810 RVA: 0x00063C00 File Offset: 0x00061E00 private PeopleFilter MakePeopleFilter(StoreId folderId, StoreId parentId, MailboxId mailboxId, string displayName, int sortGroupPriority, bool isReadOnly) { ConcatenatedIdAndChangeKey concatenatedId = IdConverter.GetConcatenatedId(folderId, mailboxId, null); FolderId parentFolderId = null; if (parentId != null) { parentFolderId = IdConverter.GetFolderIdFromStoreId(parentId, mailboxId); } return(new PeopleFilter { DisplayName = displayName, FolderId = new FolderId { Id = concatenatedId.Id }, ParentFolderId = parentFolderId, SortGroupPriority = sortGroupPriority, IsReadOnly = isReadOnly }); }
internal override void Initialize(ObjectId objectId) { if (objectId == null) { throw new ArgumentNullException("objectId"); } MailboxId mailboxId = objectId as MailboxId; if (null == mailboxId) { throw new ArgumentException(Strings.ErrorInvalidParameterType("objectId", typeof(MailboxId).Name), "objectId"); } if (!string.IsNullOrEmpty(this.displayName)) { throw new InvalidOperationException(Strings.ErrorChangeImmutableType); } if (Guid.Empty == mailboxId.MailboxGuid && string.IsNullOrEmpty(mailboxId.MailboxExchangeLegacyDn)) { throw new ArgumentException(Strings.ErrorInvalidParameterFormat("objectId"), "objectId"); } base.Initialize(objectId); }
public void Refresh(ADUser mailbox, IRecipientSession writableAdSession) { if (mailbox == null) { throw new ArgumentNullException("mailbox"); } if (writableAdSession == null) { throw new ArgumentNullException("writableAdSession"); } MapiMessageStoreSession mapiMessageStoreSession = null; try { ActiveManager activeManagerInstance = ActiveManager.GetActiveManagerInstance(); DatabaseLocationInfo serverForDatabase = activeManagerInstance.GetServerForDatabase(mailbox.Database.ObjectGuid); mapiMessageStoreSession = new MapiMessageStoreSession(serverForDatabase.ServerLegacyDN, TeamMailboxSecurityRefresher.CalculateSystemAttendantMailboxLegacyDistingushName(serverForDatabase.ServerLegacyDN), Fqdn.Parse(serverForDatabase.ServerFqdn)); MailboxId mailboxId = new MailboxId(MapiTaskHelper.ConvertDatabaseADObjectIdToDatabaseId(mailbox.Database), mailbox.ExchangeGuid); try { mapiMessageStoreSession.Administration.PurgeCachedMailboxObject(mailboxId.MailboxGuid); } catch (Microsoft.Exchange.Data.Mapi.Common.MailboxNotFoundException ex) { throw new ObjectNotFoundException(new LocalizedString(ex.ToString())); } catch (DatabaseUnavailableException ex2) { throw new ObjectNotFoundException(new LocalizedString(ex2.ToString())); } } finally { if (mapiMessageStoreSession != null) { mapiMessageStoreSession.Dispose(); } } }
internal void RefreshStoreCache() { this.AddVerboseLog("Start: RefreshStoreCache"); bool flag = this.groupMailbox.WhenMailboxCreated == null || this.groupMailbox.WhenMailboxCreated.Value.AddMinutes(15.0).ToUniversalTime() > DateTime.UtcNow; if (flag) { return; } string text = null; try { ActiveManager activeManagerInstance = ActiveManager.GetActiveManagerInstance(); DatabaseLocationInfo serverForDatabase = activeManagerInstance.GetServerForDatabase(this.groupMailbox.Database.ObjectGuid); text = serverForDatabase.ServerFqdn; using (MapiMessageStoreSession mapiMessageStoreSession = new MapiMessageStoreSession(serverForDatabase.ServerLegacyDN, serverForDatabase.ServerLegacyDN + "/cn=Microsoft System Attendant", Fqdn.Parse(serverForDatabase.ServerFqdn))) { MailboxId mailboxId = new MailboxId(MapiTaskHelper.ConvertDatabaseADObjectIdToDatabaseId(this.groupMailbox.Database), this.groupMailbox.ExchangeGuid); this.AddVerboseLog(Strings.VerboseSaveStoreMailboxSecurityDescriptor(mailboxId.ToString(), mapiMessageStoreSession.ServerName)); mapiMessageStoreSession.Administration.PurgeCachedMailboxObject(mailboxId.MailboxGuid); } } catch (DatabaseNotFoundException) { this.AddVerboseLog(Strings.ErrorMailboxDatabaseNotFound(this.groupMailbox.Database.ToString())); } catch (MapiExceptionNetworkError) { this.AddVerboseLog(Strings.ErrorFailedToConnectToStore((text != null) ? text : string.Empty)); } catch (MailboxNotFoundException) { this.AddVerboseLog(Strings.VerboseMailboxNotExistInStore(this.groupMailbox.DistinguishedName)); } this.AddVerboseLog("End: RefreshStoreCache"); }
// Token: 0x06000B57 RID: 2903 RVA: 0x0002425D File Offset: 0x0002245D public RecipientOrOrganizationIdParameter(MailboxId storeMailboxId) { this.RecipientParameter = new MailboxIdParameter(storeMailboxId); }
protected override void InternalProcessRecord() { TaskLogger.LogEnter(); foreach (Database database in this.databases) { try { Guid mailboxGuid = Guid.Empty; MailboxTableFlags mailboxTableFlags = MailboxTableFlags.MailboxTableFlagsNone; if (null != this.identity) { mailboxGuid = this.identity.MailboxGuid; } if (this.isRunningMailboxStatisticsTask) { mailboxTableFlags |= MailboxTableFlags.IncludeSoftDeletedMailbox; } QueryFilter filter = new MailboxContextFilter(mailboxGuid, (ulong)((long)mailboxTableFlags), this.NoADLookupForMailboxStatistics); IEnumerable <TPresentationObject> enumerable = this.mapiSession.FindPaged <TDataObject, TPresentationObject>(filter, MapiTaskHelper.ConvertDatabaseADObjectToDatabaseId(database), QueryScope.SubTree, null, 0, 0); foreach (TPresentationObject tpresentationObject in enumerable) { try { MailboxId mailboxId = tpresentationObject.Identity as MailboxId; if (this.Identity == null || (null != mailboxId && ((Guid.Empty != this.identity.MailboxGuid && this.identity.MailboxGuid == mailboxId.MailboxGuid) || (!string.IsNullOrEmpty(this.identity.MailboxExchangeLegacyDn) && string.Equals(this.identity.MailboxExchangeLegacyDn, mailboxId.MailboxExchangeLegacyDn, StringComparison.OrdinalIgnoreCase))))) { if (this.isRunningLogonStatisticsTask) { ((LogonStatistics)((object)tpresentationObject)).ServerName = database.ServerName; ((LogonStatistics)((object)tpresentationObject)).DatabaseName = database.Name; } else if (this.isRunningResourceMonitorDigestTask) { ((MailboxResourceMonitor)((object)tpresentationObject)).ServerName = this.server.Name; ((MailboxResourceMonitor)((object)tpresentationObject)).DatabaseName = database.Name; ((MailboxResourceMonitor)((object)tpresentationObject)).IsDatabaseCopyActive = (database.Server.ObjectGuid == this.server.Guid); } else if (this.isRunningMailboxStatisticsTask) { Microsoft.Exchange.Management.MapiTasks.Presentation.MailboxStatistics mailboxStatistics = (Microsoft.Exchange.Management.MapiTasks.Presentation.MailboxStatistics)((object)tpresentationObject); mailboxStatistics.ServerName = this.server.Name; mailboxStatistics.DatabaseName = database.Name; mailboxStatistics.Database = database.Identity; mailboxStatistics.IsDatabaseCopyActive = (database.Server.ObjectGuid == this.server.Guid); MailboxDatabase mailboxDatabase = database as MailboxDatabase; if (mailboxDatabase != null) { mailboxStatistics.DatabaseIssueWarningQuota = mailboxDatabase.IssueWarningQuota; mailboxStatistics.DatabaseProhibitSendQuota = mailboxDatabase.ProhibitSendQuota; mailboxStatistics.DatabaseProhibitSendReceiveQuota = mailboxDatabase.ProhibitSendReceiveQuota; } if (mailboxId != null && this.GetMoveHistoryOption() != MoveHistoryOption.None) { UserMailboxFlags userMailboxFlags = UserMailboxFlags.None; if (database.Recovery) { userMailboxFlags |= UserMailboxFlags.RecoveryMDB; } if (mailboxStatistics.IsMoveDestination ?? false) { userMailboxFlags |= UserMailboxFlags.MoveDestination; } else if (mailboxStatistics.DisconnectReason != null) { if (mailboxStatistics.DisconnectReason.Value == MailboxState.SoftDeleted) { userMailboxFlags |= UserMailboxFlags.SoftDeleted; } else { userMailboxFlags |= UserMailboxFlags.Disconnected; } } try { mailboxStatistics.MoveHistory = MoveHistoryEntry.LoadMoveHistory(mailboxId.MailboxGuid, database.Id.ObjectGuid, this.GetMoveHistoryOption() == MoveHistoryOption.IncludeMoveHistoryAndReport, userMailboxFlags); } catch (LocalizedException exception) { base.WriteError(exception, ErrorCategory.ResourceUnavailable, mailboxId); } } } bool flag = true; if (this.isRunningMailboxStatisticsTask) { Exception ex = null; try { QueryFilter internalFilter = this.InternalFilter; if (internalFilter != null && !OpathFilterEvaluator.FilterMatches(internalFilter, (Microsoft.Exchange.Data.Mapi.MailboxStatistics)((object)tpresentationObject))) { flag = false; } } catch (InvalidCastException ex2) { ex = ex2; } catch (ParsingException ex3) { ex = ex3; } catch (ArgumentOutOfRangeException ex4) { ex = ex4; } if (ex != null) { base.WriteError(new MdbAdminTaskException(Strings.ErrorInvalidMailboxStatisticsFilter(this.InternalFilter.ToString())), ErrorCategory.InvalidArgument, this.InternalFilter); } } if (flag) { this.WriteResult(tpresentationObject); } if (this.Identity != null && this.isRunningMailboxStatisticsTask) { TaskLogger.LogExit(); return; } } } finally { if (tpresentationObject != null) { tpresentationObject.Dispose(); } } } } catch (DatabaseUnavailableException ex5) { if (this.Identity == null && this.Database == null) { base.WriteWarning(ex5.Message); } else { base.WriteError(ex5, ErrorCategory.ResourceUnavailable, database); } } catch (MapiObjectNotFoundException exception2) { if (this.Identity == null || !this.isRunningMailboxStatisticsTask) { base.WriteError(exception2, ErrorCategory.ObjectNotFound, this.Identity); } } } if (this.Identity != null && this.isRunningMailboxStatisticsTask) { TIdentity tidentity = this.Identity; this.WriteWarning(Strings.WarningMailboxNeverBeenLoggedOn(tidentity.ToString(), this.identity.ToString())); } TaskLogger.LogExit(); }
public LogonableObjectIdParameter(MailboxId storeMailboxId) : base(storeMailboxId) { }
public StoreMailboxIdParameter(MailboxId mailboxId) : base(mailboxId) { }
// Token: 0x06001A99 RID: 6809 RVA: 0x00063744 File Offset: 0x00061944 protected override PeopleFilter[] InternalExecute() { UserContext userContext = UserContextManager.GetUserContext(CallContext.Current.HttpContext, CallContext.Current.EffectiveCaller, true); ExchangeVersion.Current = ExchangeVersion.Latest; MailboxSession mailboxIdentityMailboxSession = base.MailboxIdentityMailboxSession; MailboxId mailboxId = new MailboxId(mailboxIdentityMailboxSession); List <PeopleFilter> list = new List <PeopleFilter>(); list.Add(this.MakePeopleFilter(mailboxIdentityMailboxSession.GetDefaultFolderId(DefaultFolderType.MyContacts), mailboxIdentityMailboxSession.GetDefaultFolderId(DefaultFolderType.Configuration), mailboxId, ClientStrings.MyContactsFolderName.ToString(), 1, true)); PeopleFilterGroupPriorityManager peopleFilterGroupPriorityManager = new PeopleFilterGroupPriorityManager(mailboxIdentityMailboxSession, new XSOFactory()); foreach (IStorePropertyBag storePropertyBag in new ContactFoldersEnumerator(mailboxIdentityMailboxSession, new XSOFactory(), ContactFoldersEnumeratorOptions.SkipHiddenFolders | ContactFoldersEnumeratorOptions.SkipDeletedFolders, PeopleFilterGroupPriorityManager.RequiredFolderProperties)) { StoreObjectId objectId = ((VersionedId)storePropertyBag.TryGetProperty(FolderSchema.Id)).ObjectId; StoreObjectId parentId = storePropertyBag.TryGetProperty(StoreObjectSchema.ParentItemId) as StoreObjectId; string valueOrDefault = storePropertyBag.GetValueOrDefault <string>(FolderSchema.DisplayName, string.Empty); int sortGroupPriority = peopleFilterGroupPriorityManager.DetermineSortGroupPriority(storePropertyBag); ExtendedFolderFlags valueOrDefault2 = storePropertyBag.GetValueOrDefault <ExtendedFolderFlags>(FolderSchema.ExtendedFolderFlags, (ExtendedFolderFlags)0); bool isReadOnly = (valueOrDefault2 & ExtendedFolderFlags.ReadOnly) == ExtendedFolderFlags.ReadOnly; list.Add(this.MakePeopleFilter(objectId, parentId, mailboxId, valueOrDefault, sortGroupPriority, isReadOnly)); } if (userContext.FeaturesManager.ClientServerSettings.OwaPublicFolders.Enabled) { IFavoritePublicFoldersManager favoritePublicFoldersManager = new FavoritePublicFoldersManager(mailboxIdentityMailboxSession); List <IFavoritePublicFolder> list2 = new List <IFavoritePublicFolder>(); using (IEnumerator <IFavoritePublicFolder> enumerator2 = favoritePublicFoldersManager.EnumerateContactsFolders().GetEnumerator()) { while (enumerator2.MoveNext()) { IFavoritePublicFolder folder = enumerator2.Current; if (!list2.Exists((IFavoritePublicFolder storedFavorite) => storedFavorite.FolderId.Equals(folder.FolderId))) { list2.Add(folder); } } } if (list2.Count > 0) { for (int i = 0; i < list2.Count; i++) { list.Add(this.MakePublicFolderPeopleFilter(list2[i], i)); } } } ClientSecurityContext clientSecurityContext = base.CallContext.EffectiveCaller.ClientSecurityContext; IExchangePrincipal mailboxOwner = base.MailboxIdentityMailboxSession.MailboxOwner; AddressLists addressLists = new AddressLists(clientSecurityContext, mailboxOwner, userContext); if (addressLists.GlobalAddressList != null) { list.Add(new PeopleFilter { DisplayName = addressLists.GlobalAddressList.DisplayName, FolderId = new AddressListId { Id = addressLists.GlobalAddressList.Id.ObjectGuid.ToString() }, SortGroupPriority = 1000, IsReadOnly = true }); } if (addressLists.AllRoomsAddressList != null) { list.Add(new PeopleFilter { DisplayName = addressLists.AllRoomsAddressList.DisplayName, FolderId = new AddressListId { Id = addressLists.AllRoomsAddressList.Id.ObjectGuid.ToString() }, SortGroupPriority = 1001, IsReadOnly = true }); } foreach (AddressBookBase addressBookBase in addressLists.AllAddressLists) { if ((addressLists.GlobalAddressList == null || !addressBookBase.Id.Equals(addressLists.GlobalAddressList.Id)) && (addressLists.AllRoomsAddressList == null || !addressBookBase.Id.Equals(addressLists.AllRoomsAddressList.Id)) && !string.IsNullOrEmpty(addressBookBase.RecipientFilter) && (!addressBookBase.IsModernGroupsAddressList || userContext.FeaturesManager.ClientServerSettings.ModernGroups.Enabled)) { list.Add(new PeopleFilter { DisplayName = addressBookBase.DisplayName, FolderId = new AddressListId { Id = addressBookBase.Id.ObjectGuid.ToString() }, SortGroupPriority = (addressBookBase.IsModernGroupsAddressList ? 1009 : this.GetSortGroupPriority(addressBookBase.RecipientFilter)), IsReadOnly = true }); } } list.Sort(new PeopleFilterComparer(mailboxIdentityMailboxSession.PreferedCulture)); return(list.ToArray()); }
private static VersionedId EwsIdToVersionedId(string ewsId, string changeKey, out MailboxId mailboxId) { IdHeaderInformation idHeaderInformation = ServiceIdConverter.ConvertFromConcatenatedId(ewsId, BasicTypes.Item, null); mailboxId = idHeaderInformation.MailboxId; byte[] byteArrayChangeKey; StoreObjectType objectType; WebServiceMailboxSearchGroup.ParseChangeKeyString(changeKey, out byteArrayChangeKey, out objectType); return(VersionedId.Deserialize(idHeaderInformation.StoreIdBytes, byteArrayChangeKey, objectType)); }
/// <summary> /// Create new instance of <see cref="Group"/> /// </summary> /// <param name="exchangeService"></param> /// <param name="mailboxId"></param> internal Group(ExchangeService exchangeService, MailboxId mailboxId) : base(exchangeService) { this.MailboxId = mailboxId; }
protected static ItemId StoreIdToEwsItemId(StoreId storeId, MailboxId mailboxId) { ConcatenatedIdAndChangeKey concatenatedId = IdConverter.GetConcatenatedId(storeId, mailboxId, null); return(new ItemId(concatenatedId.Id, concatenatedId.ChangeKey)); }
// Token: 0x06000A5E RID: 2654 RVA: 0x000229B4 File Offset: 0x00020BB4 public GeneralMailboxIdParameter(MailboxId storeMailboxId) : base(storeMailboxId) { }
static Case parseCase(XElement element) { // ReSharper disable once UseObjectOrCollectionInitializer var result = new Case { Id = (CaseId)int.Parse(element.Attribute("ixBug").Value) }; result.Parent = CaseId.FromInt(getInt(element.Element(CaseColumns.Parent))); result.Children = getCaseIds(element.Element(CaseColumns.Children)); result.Duplicates = getCaseIds(element.Element(CaseColumns.Duplicates)); result.Original = CaseId.FromInt(getInt(element.Element(CaseColumns.Original))); result.Related = getCaseIds(element.Element(CaseColumns.Related)); result.Tags = getTags(element); // TODO: Write an integration test for tags. result.IsOpen = getBool(element.Element(CaseColumns.IsOpen)); result.Title = getString(element.Element(CaseColumns.Title)); result.OriginalTitle = getString(element.Element(CaseColumns.OriginalTitle)); result.LatestSummary = getString(element.Element(CaseColumns.LatestSummary)); result.LatestTextEvent = EventId.FromInt(getInt(element.Element(CaseColumns.LatestTextEvent))); result.Project = getProject(element); result.Area = new Area { Id = getInt(element.Element(CaseColumns.AreaId)), Name = getString(element.Element(CaseColumns.Area)) }; result.AssignedTo = new Person { Id = (PersonId)(getInt(element.Element(CaseColumns.AssignedToPersonId))), FullName = getString(element.Element(CaseColumns.AssignedTo)), Email = getString(element.Element(CaseColumns.AssignedToEmail)) }; result.OpenedBy = (PersonId)getInt(element.Element(CaseColumns.OpenedByPersonId)); result.ResolvedBy = PersonId.FromInt(getInt(element.Element(CaseColumns.ResolvedByPersonId))); result.ClosedBy = PersonId.FromInt(getInt(element.Element(CaseColumns.ClosedByPersonId))); result.LastEditedBy = PersonId.FromInt(getInt(element.Element(CaseColumns.LastEditedByPersonId))); result.Status = new Status { Id = (StatusId)getInt(element.Element(CaseColumns.StatusId)), Name = getString(element.Element(CaseColumns.Status)) }; result.Priority = new Priority { Id = getInt(element.Element(CaseColumns.PriorityId)), Name = getString(element.Element(CaseColumns.Priority)) }; result.FixFor = new Milestone { Id = (MilestoneId)getInt(element.Element(CaseColumns.FixForMilestoneId)), Name = getString(element.Element(CaseColumns.FixFor)), Date = getDate(element.Element(CaseColumns.FixForDate)) }; result.Version = getString(element.Element(CaseColumns.Version)); result.Computer = getString(element.Element(CaseColumns.Computer)); result.EstimateHoursOriginal = getDecimal(element.Element(CaseColumns.EstimateHoursOriginal)); result.EstimateHoursCurrent = getDecimal(element.Element(CaseColumns.EstimateHoursCurrent)); result.ElapsedHours = getDecimal(element.Element(CaseColumns.ElapsedHours)); result.Occurrences = getInt(element.Element(CaseColumns.Occurrences)) + 1; result.CustomerEmail = getString(element.Element(CaseColumns.CustomerEmail)); result.Mailbox = MailboxId.FromInt(getInt(element.Element(CaseColumns.MailboxId))); result.Category = new Category { Id = getInt(element.Element(CaseColumns.CategoryId)), Name = getString(element.Element(CaseColumns.Category)) }; result.OpenedDate = getDate(element.Element(CaseColumns.OpenedDate)); result.ResolvedDate = getDate(element.Element(CaseColumns.ResolvedDate)); result.ClosedDate = getDate(element.Element(CaseColumns.ClosedDate)); result.LatestEvent = EventId.FromInt(getInt(element.Element(CaseColumns.LatestEventId))); result.LastUpdatedDate = getDate(element.Element(CaseColumns.LastUpdatedDate)); result.Replied = getBool(element.Element(CaseColumns.Replied)); result.Forwarded = getBool(element.Element(CaseColumns.Forwarded)); result.Ticket = getString(element.Element(CaseColumns.Ticket)); result.DiscussionTopic = DiscussionId.FromInt(getInt(element.Element(CaseColumns.DiscussionTopicId))); result.DueDate = getDate(element.Element(CaseColumns.DueDate)); result.ReleaseNotes = getString(element.Element(CaseColumns.ReleaseNotes)); result.LastViewedEvent = EventId.FromInt(getInt(element.Element(CaseColumns.LastViewedEventId))); result.LastViewedDate = getDate(element.Element(CaseColumns.LastViewedDate)); result.ScoutDescription = getString(element.Element(CaseColumns.ScoutDescription)); result.ScoutMessage = getString(element.Element(CaseColumns.ScoutMessage)); result.ScoutStopReporting = getBool(element.Element(CaseColumns.ScoutStopReporting)); result.ScoutLastOccurrence = getDate(element.Element(CaseColumns.ScoutLastOccurrence)); result.Subscribed = getBool(element.Element(CaseColumns.Subscribed)); //var operations = element.Attribute("operations"); return(result); }
public void TestMailboxIdProperties() { MailboxId mailboxId = new MailboxId("*****@*****.**"); Assert.AreEqual( mailboxId.Id, "*****@*****.**"); Assert.IsTrue(mailboxId.IdInEmailAddressForm); Assert.IsFalse(mailboxId.IdInMeForm); Assert.AreEqual( mailboxId.Path, "users/[email protected]"); Assert.IsTrue(mailboxId.Equals(new MailboxId("*****@*****.**"))); mailboxId = new MailboxId("me"); Assert.IsTrue(mailboxId.IdInMeForm); Assert.IsFalse(mailboxId.IdInEmailAddressForm); Assert.AreEqual( mailboxId.Path, "me"); Assert.IsFalse(mailboxId.Equals(null)); Assert.AreEqual( mailboxId.ToString(), "me"); string guidFormat = "35190d3b-a0c3-462f-873d-14739728ec13@fddcbad5-788b-4eb8-be11-21d569abe684"; mailboxId = new MailboxId(guidFormat); Assert.AreEqual( mailboxId.Id, guidFormat); Assert.AreEqual( mailboxId.Path, $"users/{guidFormat}"); string invalidGuidFormat1 = "35190d3b-a0c3-462f873d-14739728ec13@fddcbad5-788b-4eb8-be11-21d569abe684"; string invalidGuidFormat2 = "35190d3b-a0c3-462f-873d-14739728ec13@fddcbad5-788b-4eb8be11-21d569abe684"; string invalidGuidFormat3 = "35190d3b-a0c3-462f-873d-14739728ec13@"; string invalidFormat1 = "fsdsfsfds"; string invalidFormat2 = "fsdfs@fsfsd@fs"; Assert.ThrowsException <ArgumentException>(() => { mailboxId = new MailboxId(invalidGuidFormat1); }); Assert.ThrowsException <ArgumentException>(() => { mailboxId = new MailboxId(invalidGuidFormat2); }); Assert.ThrowsException <ArgumentException>(() => { mailboxId = new MailboxId(invalidGuidFormat3); }); Assert.ThrowsException <ArgumentException>(() => { mailboxId = new MailboxId(invalidFormat1); }); Assert.ThrowsException <ArgumentException>(() => { mailboxId = new MailboxId(invalidFormat2); }); }
public MailboxIdentity(MailboxId rawIdentity) : base(rawIdentity.ToString(), rawIdentity.ToString()) { }
// Token: 0x06000A52 RID: 2642 RVA: 0x000228F4 File Offset: 0x00020AF4 public MailboxIdParameter(MailboxId storeMailboxId) : this((null == storeMailboxId) ? null : ((Guid.Empty == storeMailboxId.MailboxGuid) ? storeMailboxId.MailboxExchangeLegacyDn : storeMailboxId.MailboxGuid.ToString())) { }