// Token: 0x060009A2 RID: 2466 RVA: 0x000408EC File Offset: 0x0003EAEC public MailboxData(MailboxSession session) { this.Settings = new UserSettings(session); this.databaseGuid = session.MailboxOwner.MailboxInfo.GetDatabaseGuid(); this.mailboxGuid = session.MailboxOwner.MailboxInfo.MailboxGuid; this.defaultCalendarFolderId = session.GetDefaultFolderId(DefaultFolderType.Calendar); this.defaultDeletedItemsFolderId = session.GetDefaultFolderId(DefaultFolderType.DeletedItems); this.defaultJunkEmailFolderId = session.GetDefaultFolderId(DefaultFolderType.JunkEmail); this.defaultOutboxFolderId = session.GetDefaultFolderId(DefaultFolderType.Outbox); }
// Token: 0x06000997 RID: 2455 RVA: 0x00040678 File Offset: 0x0003E878 internal InfoFromUserMailboxSession(MailboxSession session) { this.UserLegacyDN = session.MailboxOwnerLegacyDN; this.DatabaseGuid = session.MailboxOwner.MailboxInfo.GetDatabaseGuid(); this.MailboxGuid = session.MailboxOwner.MailboxInfo.MailboxGuid; this.ExternalDirectoryOrganizationId = UserSettings.GetExternalDirectoryOrganizationId(session); this.DefaultCalendarFolderId = session.GetDefaultFolderId(DefaultFolderType.Calendar); this.DefaultDeletedItemsFolderId = session.GetDefaultFolderId(DefaultFolderType.DeletedItems); this.DefaultJunkEmailFolderId = session.GetDefaultFolderId(DefaultFolderType.JunkEmail); this.DefaultOutboxFolderId = session.GetDefaultFolderId(DefaultFolderType.Outbox); }
// Token: 0x06000125 RID: 293 RVA: 0x00007278 File Offset: 0x00005478 internal void LoadData(MailboxSession session) { if (this.sentItemsFolderId == null) { StoreObjectId defaultFolderId = session.GetDefaultFolderId(DefaultFolderType.SentItems); if (defaultFolderId != null) { this.sentItemsFolderId = defaultFolderId.ProviderLevelItemId; } else { MailboxData.Tracer.TraceError((long)this.GetHashCode(), "{0}: Sent items folder id is null", new object[] { TraceContext.Get() }); } } if (this.outboxFolderId == null) { StoreObjectId defaultFolderId2 = session.GetDefaultFolderId(DefaultFolderType.Outbox); if (defaultFolderId2 != null) { this.outboxFolderId = defaultFolderId2.ProviderLevelItemId; } else { MailboxData.Tracer.TraceError((long)this.GetHashCode(), "{0}: Outbox folder id is null", new object[] { TraceContext.Get() }); } } if (this.inboxFolderId == null) { StoreObjectId defaultFolderId3 = session.GetDefaultFolderId(DefaultFolderType.Inbox); if (defaultFolderId3 != null) { this.inboxFolderId = defaultFolderId3.ProviderLevelItemId; } else { MailboxData.Tracer.TraceError((long)this.GetHashCode(), "{0}: Inbox folder id is null", new object[] { TraceContext.Get() }); } } int totalActionItemCount; ConversationActionItem.QueryConversationActionsFolder(session, null, 0, out totalActionItemCount); this.UpdateConversationActionsEnabledStatus(totalActionItemCount); }
internal void SendABQNotificationMail() { using (MailboxSession mailboxSession = MailboxSession.OpenAsSystemService(this.context.User.ExchangePrincipal, this.context.Request.Culture, "Client=ActiveSync;Action=ABQMail")) { this.cultureInfo = mailboxSession.PreferedCulture; MicrosoftExchangeRecipient exchangeRecipient = this.organizationSettings.GetExchangeRecipient(); StoreObjectId defaultFolderId = mailboxSession.GetDefaultFolderId(DefaultFolderType.Inbox); using (MessageItem messageItem = MessageItem.Create(mailboxSession, defaultFolderId)) { this.ConstructUserNotificationMail(messageItem); messageItem.From = ((exchangeRecipient == null) ? new Participant(mailboxSession.MailboxOwner) : new Participant(exchangeRecipient)); messageItem.Recipients.Add(new Participant(mailboxSession.MailboxOwner), RecipientItemType.To); messageItem[MessageItemSchema.IsDraft] = false; messageItem[MessageItemSchema.IsRead] = false; messageItem.Save(SaveMode.NoConflictResolution); messageItem.Load(new PropertyDefinition[0]); this.globalInfo.ABQMailId = messageItem.Id.ObjectId; this.globalInfo.ABQMailState = ABQMailState.MailPosted; } defaultFolderId = mailboxSession.GetDefaultFolderId(DefaultFolderType.Drafts); if (this.globalInfo.DeviceAccessState == DeviceAccessState.Quarantined) { using (MessageItem messageItem2 = MessageItem.Create(mailboxSession, defaultFolderId)) { foreach (SmtpAddress smtpAddress in this.organizationSettings.AdminMailRecipients) { Participant participant; if (smtpAddress.IsValidAddress && Participant.TryParse(smtpAddress.ToString(), out participant) && participant != null) { messageItem2.Recipients.Add(participant, RecipientItemType.To); } } if (messageItem2.Recipients.Count > 0) { this.ConstructAdminNotificationMail(messageItem2); messageItem2.From = ((exchangeRecipient == null) ? new Participant(mailboxSession.MailboxOwner) : new Participant(exchangeRecipient)); messageItem2.SendWithoutSavingMessage(); } else { AirSyncDiagnostics.TraceError(ExTraceGlobals.RequestsTracer, null, "ABQMail:No valid AdminMailRecipients to send Admin mail to!"); if (VariantConfiguration.InvariantNoFlightingSnapshot.ActiveSync.ActiveSyncDiagnosticsLogABQPeriodicEvent.Enabled) { AirSyncDiagnostics.LogPeriodicEvent(AirSyncEventLogConstants.Tuple_NoAdminMailRecipientsError, "NoAdminMailRecipients", new string[0]); } } } } } }
internal StoreId[] GetFolderScope(MailboxSession mailbox) { StoreId defaultFolderId = mailbox.GetDefaultFolderId(DefaultFolderType.Root); StoreId defaultFolderId2 = mailbox.GetDefaultFolderId(DefaultFolderType.RecoverableItemsRoot); StoreId[] array; if (!this.SearchDumpsterOnly) { array = new StoreId[] { defaultFolderId }; } else { array = new StoreId[0]; } if ((this.SearchDumpsterOnly || this.SearchDumpster) && defaultFolderId2 != null) { QueryFilter queryFilter = DumpsterFolderHelper.ExcludeAuditFoldersFilter; if (this.excludePurgesFromDumpster && SearchUtils.LegalHoldEnabled(mailbox)) { queryFilter = new AndFilter(new QueryFilter[] { queryFilter, new ComparisonFilter(ComparisonOperator.NotEqual, StoreObjectSchema.DisplayName, "DiscoveryHolds") }); if (mailbox.COWSettings.HoldEnabled() && !mailbox.COWSettings.IsOnlyInPlaceHoldEnabled()) { queryFilter = new AndFilter(new QueryFilter[] { queryFilter, new ComparisonFilter(ComparisonOperator.NotEqual, StoreObjectSchema.DisplayName, "Purges") }); } } using (Folder folder = Folder.Bind(mailbox, defaultFolderId2)) { using (QueryResult queryResult = folder.FolderQuery(FolderQueryFlags.None, queryFilter, null, new PropertyDefinition[] { FolderSchema.Id })) { array = array.Concat(queryResult.Enumerator <StoreId>()).ToArray <StoreId>(); } } } return(array); }
public void RemoveOtherInbox() { base.ThrowIfCannotActAsOwner(); OwaStoreObjectId owaStoreObjectId = (OwaStoreObjectId)base.GetParameter("Id"); if (owaStoreObjectId.MailboxOwnerLegacyDN == null) { throw new OwaInvalidRequestException("Can't find legacyDN information."); } OtherMailboxConfiguration.RemoveOtherMailbox(base.UserContext, owaStoreObjectId.MailboxOwnerLegacyDN); try { MailboxSession mailboxSession = owaStoreObjectId.GetSession(base.UserContext) as MailboxSession; StoreObjectId defaultFolderId = mailboxSession.GetDefaultFolderId(DefaultFolderType.Inbox); if (defaultFolderId != null) { OwaStoreObjectId owaStoreObjectId2 = OwaStoreObjectId.CreateFromSessionFolderId(base.UserContext, mailboxSession, defaultFolderId); if (base.UserContext.IsPushNotificationsEnabled) { base.UserContext.MapiNotificationManager.UnsubscribeFolderCounts(owaStoreObjectId2, mailboxSession); base.UserContext.MapiNotificationManager.UnsubscribeFolderChanges(owaStoreObjectId2, mailboxSession); } if (base.UserContext.IsPullNotificationsEnabled) { base.UserContext.NotificationManager.DeleteDelegateFolderCountAdvisor(owaStoreObjectId2); base.UserContext.NotificationManager.DeleteOwaConditionAdvisor(owaStoreObjectId2); } } } catch (ObjectNotFoundException arg) { ExTraceGlobals.CoreCallTracer.TraceDebug <ObjectNotFoundException>(0L, "NavigationNodeEventHandler.RemoveOtherInbox() exception {0}", arg); } }
public static void CheckAndCreateDefaultFolders(MailboxSession session) { if (session.GetDefaultFolderId(DefaultFolderType.AllItems) == null) { session.CreateDefaultFolder(DefaultFolderType.AllItems); } }
// Token: 0x06000D01 RID: 3329 RVA: 0x0003629C File Offset: 0x0003449C internal Folder GetFolder(MailboxSession mailboxSession) { Folder folder = Folder.Create(mailboxSession, mailboxSession.GetDefaultFolderId(DefaultFolderType.Configuration), StoreObjectType.Folder, this.folderName, CreateMode.OpenIfExists); if (folder.Id == null) { this.tracer.TraceDebug <string>((long)this.GetHashCode(), "Found no folder '{0}' in mailbox", this.folderName); bool flag = false; try { folder.Save(); folder.Load(new PropertyDefinition[] { FolderSchema.Id }); flag = true; this.tracer.TraceDebug <string, VersionedId>((long)this.GetHashCode(), "Created new folder '{0}' in mailbox. Id: {1}", this.folderName, folder.Id); return(folder); } finally { if (!flag) { folder.Dispose(); } } } this.tracer.TraceDebug <VersionedId>((long)this.GetHashCode(), "Found existing folder '{0}' in mailbox. Id: {1}", folder.Id); return(folder); }
private void SendLocalizedEmail(MailboxSession session, NewExchangeNotification.NotificationEmailInfo emailInfo) { if (session == null) { throw new ArgumentNullException("session"); } if (emailInfo.Recipients == null || emailInfo.Recipients.Count <SmtpAddress>() == 0) { return; } using (MessageItem messageItem = MessageItem.Create(session, session.GetDefaultFolderId(DefaultFolderType.Drafts))) { foreach (SmtpAddress smtpAddress in emailInfo.Recipients) { messageItem.Recipients.Add(new Participant(string.Empty, smtpAddress.ToString(), "SMTP")); } string eventCategory; string localizedEventMessageAndCategory = this.GetLocalizedEventMessageAndCategory(emailInfo.Language, out eventCategory); messageItem.Subject = Strings.TenantNotificationSubject(eventCategory, this.DataObject.EventDisplayId).ToString(emailInfo.Language); using (Stream stream = messageItem.Body.OpenWriteStream(new BodyWriteConfiguration(BodyFormat.TextHtml, Charset.Unicode))) { using (StreamWriter streamWriter = new StreamWriter(stream, Encoding.Unicode)) { string helpUrlForNotification = this.GetHelpUrlForNotification(emailInfo.Language); OrganizationId currentOrganizationId = base.CurrentTaskContext.UserInfo.CurrentOrganizationId; streamWriter.WriteLine(Strings.TenantNotificationBody(HttpUtility.HtmlEncode((currentOrganizationId == null) ? string.Empty : currentOrganizationId.GetFriendlyName()), HttpUtility.HtmlEncode(this.DataObject.EventTimeUtc.ToString("f", emailInfo.Language)), (!string.IsNullOrEmpty(localizedEventMessageAndCategory)) ? HttpUtility.HtmlEncode(localizedEventMessageAndCategory) : Strings.TenantNotificationUnavailableEventMessage.ToString(emailInfo.Language), HttpUtility.HtmlEncode(helpUrlForNotification)).ToString(emailInfo.Language)); } } messageItem.AutoResponseSuppress = AutoResponseSuppress.All; messageItem.InternetMessageId = emailInfo.MessageId; messageItem.SendWithoutSavingMessage(); } }
private void WorkWithPermissions(MailboxSession itemStore) { if (this.delegatesToAddPermission.Count > 0 || this.delegatesToRemovePermission.Count > 0 || this.policyMembersToAddPermission.Count > 0 || this.policyMembersToRemovePermission.Count > 0 || this.oldAllPolicy != this.newAllPolicy) { using (CalendarFolder calendarFolder = CalendarFolder.Bind(itemStore, DefaultFolderType.Calendar)) { using (Folder folder = Folder.Create(itemStore, itemStore.GetDefaultFolderId(DefaultFolderType.Configuration), StoreObjectType.Folder, "Freebusy Data", CreateMode.OpenIfExists)) { CalendarFolderPermissionSet permissionSet = calendarFolder.GetPermissionSet(); PermissionSet permissionSet2 = folder.GetPermissionSet(); permissionSet.DefaultPermission.FreeBusyAccess = (this.newAllPolicy ? FreeBusyAccess.Details : FreeBusyAccess.Basic); this.AddPermissions(permissionSet, permissionSet2); this.RemovePermissions(permissionSet, permissionSet2); FolderSaveResult folderSaveResult = folder.Save(); if (folderSaveResult != null && folderSaveResult.OperationResult != OperationResult.Succeeded) { base.ThrowTerminatingError(new FolderSaveException(Strings.CalendarSave, folderSaveResult), ErrorCategory.InvalidOperation, null); } folderSaveResult = calendarFolder.Save(); if (folderSaveResult != null && folderSaveResult.OperationResult != OperationResult.Succeeded) { base.ThrowTerminatingError(new FolderSaveException(Strings.CalendarSave, folderSaveResult), ErrorCategory.InvalidOperation, null); } } } if (this.delegatesToAddPermission.Count > 0 || this.delegatesToRemovePermission.Count > 0) { this.DataObject.GrantSendOnBehalfTo = this.Instance.ResourceDelegates; base.DataSession.Save(this.DataObject); } } }
private static byte[] CreateFreeBusyMessage(MailboxSession session, out FolderSaveResult result) { StoreId defaultFolderId = session.GetDefaultFolderId(DefaultFolderType.FreeBusyData); if (defaultFolderId == null) { ExTraceGlobals.CalendarLoggingTracer.TraceError(0L, "FreeBusyUtil::CreateFreeBusyMessage. No FreeBusyData folder found."); throw new DelegateUserNoFreeBusyFolderException(ServerStrings.NoFreeBusyFolder); } ExTraceGlobals.CalendarLoggingTracer.TraceDebug(0L, "FreeBusyUtil::CreateFreeBusyMessage. Creating the message"); byte[] providerLevelItemId; using (MessageItem messageItem = MessageItem.Create(session, defaultFolderId)) { messageItem.Subject = FreeBusyUtil.LocalFbSubject; messageItem.ClassName = FreeBusyUtil.LocalFbMessageClass; messageItem.Save(SaveMode.ResolveConflicts); messageItem.Load(null); providerLevelItemId = messageItem.Id.ObjectId.ProviderLevelItemId; } result = null; ExTraceGlobals.CalendarLoggingTracer.TraceDebug(0L, "FreeBusyUtil::CreateFreeBusyMessage. Stamping the entry id on the inbox"); FolderSaveResult folderSaveResult = FreeBusyUtil.StampFreeBusyMsgId(session, providerLevelItemId, DefaultFolderType.Inbox); if (folderSaveResult.OperationResult != OperationResult.Succeeded) { result = folderSaveResult; } ExTraceGlobals.CalendarLoggingTracer.TraceDebug(0L, "FreeBusyUtil::CreateFreeBusyMessage. Stamping the entry id on the configuration folder"); folderSaveResult = FreeBusyUtil.StampFreeBusyMsgId(session, providerLevelItemId, DefaultFolderType.Configuration); if (folderSaveResult.OperationResult != OperationResult.Succeeded) { result = folderSaveResult; } return(providerLevelItemId); }
internal static MeetingForwardNotification Create(MeetingRequest request) { MailboxSession mailboxSession = request.Session as MailboxSession; if (mailboxSession == null) { throw new NotSupportedException(); } MeetingForwardNotification meetingForwardNotification = null; bool flag = false; MeetingForwardNotification result; try { StoreObjectId defaultFolderId = mailboxSession.GetDefaultFolderId((mailboxSession.LogonType == LogonType.Transport) ? DefaultFolderType.SentItems : DefaultFolderType.Drafts); meetingForwardNotification = ItemBuilder.CreateNewItem <MeetingForwardNotification>(mailboxSession, defaultFolderId, request.IsSeriesMessage ? ItemCreateInfo.MeetingForwardNotificationSeriesInfo : ItemCreateInfo.MeetingForwardNotificationInfo); meetingForwardNotification.Load(InternalSchema.ContentConversionProperties); meetingForwardNotification.Initialize(request, request.IsSeriesMessage ? "IPM.MeetingMessageSeries.Notification.Forward" : "IPM.Schedule.Meeting.Notification.Forward"); flag = true; result = meetingForwardNotification; } finally { if (!flag && meetingForwardNotification != null) { meetingForwardNotification.Dispose(); } } return(result); }
public ApprovalEngine.ApprovalProcessResults Process() { MailboxSession mailboxSession = (MailboxSession)this.messageItem.Session; Stopwatch stopwatch = new Stopwatch(); stopwatch.Start(); StoreObjectId defaultFolderId = mailboxSession.GetDefaultFolderId(DefaultFolderType.Inbox); VersionedId correlatedItem = this.messageItem.VotingInfo.GetCorrelatedItem(defaultFolderId); stopwatch.Stop(); long elapsedMilliseconds = stopwatch.ElapsedMilliseconds; if (correlatedItem == null) { DecisionHandler.diag.TraceDebug((long)this.GetHashCode(), "Initiation message not found"); return(new ApprovalEngine.ApprovalProcessResults(ApprovalEngine.ProcessResult.InitiationNotFoundForDecision, elapsedMilliseconds)); } string existingDecisionMakerAddress; ApprovalStatus? existingApprovalStatus; ExDateTime? existingDecisionTime; DecisionConflict conflict; if (DecisionHandler.ApproveTextList.Contains(this.messageItem.VotingInfo.Response)) { conflict = ApprovalProcessor.ApproveRequest(mailboxSession, correlatedItem.ObjectId, (SmtpAddress)this.sender, this.messageItem.Body, out existingDecisionMakerAddress, out existingApprovalStatus, out existingDecisionTime); } else { conflict = ApprovalProcessor.RejectRequest(mailboxSession, correlatedItem.ObjectId, (SmtpAddress)this.sender, this.messageItem.Body, out existingDecisionMakerAddress, out existingApprovalStatus, out existingDecisionTime); } return(DecisionHandler.GetApprovalProcessResults(conflict, existingDecisionMakerAddress, existingApprovalStatus, existingDecisionTime, elapsedMilliseconds)); }
public void Save(IConfigurable instance) { this.mailMessage = (MailMessage)instance; CultureInfo currentCulture = CultureInfo.CurrentCulture; using (MailboxSession mailboxSession = MailboxSession.OpenAsAdmin(ExchangePrincipal.FromDirectoryObjectId(this.adSession, this.mailbox.Id, RemotingOptions.LocalConnectionsOnly), currentCulture, "Client=Management;Action=New-MailMessage")) { StoreObjectId defaultFolderId = mailboxSession.GetDefaultFolderId(DefaultFolderType.Drafts); using (MessageItem messageItem = MessageItem.Create(mailboxSession, defaultFolderId)) { if (!string.IsNullOrEmpty(this.mailMessage.Subject)) { messageItem.Subject = this.mailMessage.Subject; } if (!string.IsNullOrEmpty(this.mailMessage.Body)) { using (TextWriter textWriter = messageItem.Body.OpenTextWriter((BodyFormat)this.mailMessage.BodyFormat)) { textWriter.WriteLine(this.mailMessage.Body); } } messageItem.Save(SaveMode.NoConflictResolution); messageItem.Load(); this.mailMessage.SetIdentity(messageItem.Id.ObjectId); } } }
public static bool IsDumpsterFolder(MailboxSession session, StoreObjectId folderId) { Util.ThrowOnNullArgument(session, "session"); if (folderId == null) { return(false); } foreach (DefaultFolderType defaultFolderType in DumpsterFolderHelper.dumpsterFoldersTypes) { if (folderId.Equals(session.GetDefaultFolderId(defaultFolderType))) { return(true); } } return(folderId.Equals(session.GetDefaultFolderId(DefaultFolderType.RecoverableItemsDiscoveryHolds)) || folderId.Equals(session.GetDefaultFolderId(DefaultFolderType.RecoverableItemsMigratedMessages)) || DumpsterFolderHelper.IsAuditFolder(session, folderId)); }
public static void CheckAndCreateFolder(MailboxSession session) { Util.ThrowOnNullArgument(session, "session"); if (session.LogonType == LogonType.Delegated) { return; } foreach (DefaultFolderType defaultFolderType in DumpsterFolderHelper.dumpsterFoldersTypes) { if (session.GetDefaultFolderId(defaultFolderType) == null) { StoreObjectId storeObjectId = session.CreateDefaultFolder(defaultFolderType); session.GetDefaultFolderId(defaultFolderType); } } }
protected override void InternalProcessRecord() { TaskLogger.LogEnter(); ADUser aduser = (ADUser)base.GetDataObject <ADUser>(this.Mailbox, base.TenantGlobalCatalogSession, null, new LocalizedString?(Strings.ErrorMailboxAddressNotFound(this.Mailbox.ToString())), new LocalizedString?(Strings.ErrorMailboxAddressNotFound(this.Mailbox.ToString()))); ExchangePrincipal principal = ExchangePrincipal.FromADUser(aduser, RemotingOptions.AllowCrossSite); using (MailboxSession mailboxSession = StoreTasksHelper.OpenMailboxSession(principal, "Get-PushNotificationSubscription")) { StoreObjectId defaultFolderId = mailboxSession.GetDefaultFolderId(DefaultFolderType.PushNotificationRoot); if (defaultFolderId != null) { using (IFolder folder = GetPushNotificationSubscription.xsoFactory.BindToFolder(mailboxSession, defaultFolderId)) { IEnumerable <IStorePropertyBag> enumerable; if (this.ShowAll) { enumerable = new SubscriptionItemEnumerator(folder, this.ResultSize); } else { enumerable = new ActiveSubscriptionItemEnumerator(folder, this.ExpirationTimeInHours, this.ResultSize); } foreach (IStorePropertyBag propertyBag in enumerable) { this.WriteResult(this.CreatePresentationObject(propertyBag, aduser, mailboxSession)); } } } } TaskLogger.LogExit(); }
internal static void Delete(MailboxSession mailboxSession) { mailboxSession.UserConfigurationManager.DeleteFolderConfigurations(mailboxSession.GetDefaultFolderId(DefaultFolderType.Calendar), new string[] { "CategoryList" }); }
public static UserConfiguration GetInferenceSettingsConfiguration(MailboxSession session) { StoreId defaultFolderId = session.GetDefaultFolderId(DefaultFolderType.Inbox); UserConfiguration userConfiguration = null; bool deleteOld = false; try { userConfiguration = session.UserConfigurationManager.GetFolderConfiguration("Inference.Settings", UserConfigurationTypes.Dictionary, defaultFolderId, null); } catch (ObjectNotFoundException arg) { InferenceDiagnosticsLog.Log("ClutterUtilities.GetInferenceSettingsConfiguration", string.Format("'{0}' is missing. Exception: {1}", "Inference.Settings", arg)); } catch (CorruptDataException arg2) { deleteOld = true; InferenceDiagnosticsLog.Log("ClutterUtilities.GetInferenceSettingsConfiguration", string.Format("'{0}' is corrupt. Exception: {1}", "Inference.Settings", arg2)); } if (userConfiguration == null || userConfiguration.GetDictionary() == null) { userConfiguration = ClutterUtilities.ResetInferenceSettingsConfiguration(session, deleteOld); } return(userConfiguration); }
public static CalendarGroupEntry BindFromCalendarFolder(MailboxSession session, StoreObjectId calendarFolderObjectId) { Util.ThrowOnNullArgument(session, "session"); Util.ThrowOnNullArgument(calendarFolderObjectId, "calendarFolderObjectId"); if (calendarFolderObjectId.ObjectType != StoreObjectType.CalendarFolder && calendarFolderObjectId.ObjectType != StoreObjectType.Folder) { throw new ArgumentException("StoreObject is not a calendar folder.", "calendarFolderObjectId"); } VersionedId groupEntryIdFromFolderId = CalendarGroupEntry.GetGroupEntryIdFromFolderId(session, calendarFolderObjectId); if (groupEntryIdFromFolderId == null) { if (calendarFolderObjectId.Equals(session.GetDefaultFolderId(DefaultFolderType.Calendar))) { using (CalendarGroup calendarGroup = CalendarGroup.Bind(session, FolderTreeData.MyFoldersClassId)) { ReadOnlyCollection <CalendarGroupEntryInfo> childCalendars = calendarGroup.GetChildCalendars(); foreach (CalendarGroupEntryInfo calendarGroupEntryInfo in childCalendars) { LocalCalendarGroupEntryInfo localCalendarGroupEntryInfo = calendarGroupEntryInfo as LocalCalendarGroupEntryInfo; if (localCalendarGroupEntryInfo != null && calendarFolderObjectId.Equals(localCalendarGroupEntryInfo.CalendarId)) { return(CalendarGroupEntry.Bind(session, calendarGroupEntryInfo.Id, null)); } } } } throw new ObjectNotFoundException(ServerStrings.ExItemNotFound); } return(CalendarGroupEntry.Bind(session, groupEntryIdFromFolderId, null)); }
private void ChangeDestinationFolder(DefaultFolderType folderType, StoreDriverDeliveryEventArgs args) { StoreDriverDeliveryEventArgsImpl storeDriverDeliveryEventArgsImpl = (StoreDriverDeliveryEventArgsImpl)args; string text = args.MailItem.FromAddress.ToString(); MailboxSession mailboxSession = storeDriverDeliveryEventArgsImpl.MailboxSession; string text2 = storeDriverDeliveryEventArgsImpl.MailRecipient.MsgId.ToString(); bool flag = this.IsSourceEhaMigration(storeDriverDeliveryEventArgsImpl.MailItem, text2); UnJournalAgent.Tracer.TraceDebug(0L, "ChangeDestinationFolder: MessageId {0}, Sender {1}, isSourceEha {2}, folderType {3} ", new object[] { text2, text, flag.ToString(), folderType.ToString() }); if (DefaultFolderType.LegacyArchiveJournals == folderType || !flag) { UnJournalAgent.Tracer.TraceDebug <string, string>(0L, "ChangeDestinationFolder: MessageId {0}, Sender {1}, Source is not EHA or this is directed to legacyarchivejournals folder in journalndr mailbox", text2, text); StoreId storeId = mailboxSession.GetDefaultFolderId(folderType); if (storeId == null) { storeId = mailboxSession.CreateDefaultFolder(folderType); } if (storeId != null) { storeDriverDeliveryEventArgsImpl.DeliverToFolder = storeId; return; } } else { UnJournalAgent.Tracer.TraceDebug <string, string>(0L, "ChangeDestinationFolder: MessageId {0}, Sender {1}, This is a migration message from EHA, put it in the hidden folder", text2, text); storeDriverDeliveryEventArgsImpl.DeliverToFolder = this.GetCreateFolderIdUnderGivenParentFolder("MigrationFolder", folderType.ToString(), mailboxSession); } }
internal void SendMdmQuarantineEmail(bool isEnrolled) { using (MailboxSession mailboxSession = MailboxSession.OpenAsSystemService(this.context.User.ExchangePrincipal, this.context.Request.Culture, "Client=ActiveSync;Action=MDMQuarantineMail")) { this.cultureInfo = mailboxSession.PreferedCulture; MicrosoftExchangeRecipient exchangeRecipient = this.organizationSettings.GetExchangeRecipient(); StoreObjectId defaultFolderId = mailboxSession.GetDefaultFolderId(DefaultFolderType.Inbox); using (MessageItem messageItem = MessageItem.CreateAssociated(mailboxSession, defaultFolderId)) { string empty = string.Empty; string empty2 = string.Empty; this.ConstructMDMQuarantineNotificationMail(isEnrolled, out empty, out empty2); messageItem.Subject = empty; using (TextWriter textWriter = messageItem.Body.OpenTextWriter(BodyFormat.TextHtml)) { textWriter.Write(empty2); } messageItem.From = ((exchangeRecipient == null) ? new Participant(mailboxSession.MailboxOwner) : new Participant(exchangeRecipient)); messageItem.Recipients.Add(new Participant(mailboxSession.MailboxOwner), RecipientItemType.To); messageItem[MessageItemSchema.IsDraft] = false; messageItem[MessageItemSchema.IsRead] = false; messageItem.Save(SaveMode.NoConflictResolution); messageItem.Load(); this.context.ProtocolLogger.AppendValue(ProtocolLoggerData.GraphApiCallData, string.Format("qes:{0}", true)); this.globalInfo.ABQMailId = messageItem.Id.ObjectId; this.globalInfo.ABQMailState = ABQMailState.MailPosted; } } }
public void SendNotification() { EmailNotificationHandler.Tracer.TraceDebug <string>((long)this.GetHashCode(), "EmailNotificationHandler.SendNotification: Processing notifications for Group {0}.", this.groupMailbox.ExternalDirectoryObjectId); IExtensibleLogger logger = MailboxAssociationDiagnosticsFrameFactory.Default.CreateLogger(this.groupMailbox.ExchangeGuid, this.groupMailbox.OrganizationId); IMailboxAssociationPerformanceTracker performanceTracker = MailboxAssociationDiagnosticsFrameFactory.Default.CreatePerformanceTracker(null); using (MailboxAssociationDiagnosticsFrameFactory.Default.CreateDiagnosticsFrame("EmailNotificationHandler", "SendNotification", logger, performanceTracker)) { GroupMailboxAccessLayerHelper.ExecuteOperationWithRetry(logger, "EmailNotificationHandler.SendNotification", delegate { using (MailboxSession session = MailboxSession.OpenAsTransport(this.exchangePrincipal, this.clientInfoString)) { EmailNotificationHandler.Tracer.TraceDebug <Guid, string>((long)this.GetHashCode(), "EmailNotificationHandler.SendNotification: Created transport session for mailbox {0}. Group {1}.", session.MailboxGuid, this.groupMailbox.ExternalDirectoryObjectId); StoreObjectId draftsFolderId = session.GetDefaultFolderId(DefaultFolderType.Drafts); while (!this.pendingRecipients.IsEmpty) { IMailboxLocator recipient; while (this.pendingRecipients.TryDequeue(out recipient)) { performanceTracker.IncrementAssociationsRead(); GroupMailboxAccessLayerHelper.ExecuteOperationWithRetry(logger, "EmailNotificationHandler.ComposeAndDeliverMessage", delegate { this.ComposeAndDeliverMessage(session, draftsFolderId, recipient, performanceTracker, logger); }, (Exception e) => !(e is StoragePermanentException) && GrayException.IsGrayException(e)); } } } }, new Predicate <Exception>(GrayException.IsGrayException)); } EmailNotificationHandler.Tracer.TraceDebug((long)this.GetHashCode(), "EmailNotificationHandler.SendNotification: Task completed."); }
internal static IdAndSession GetFolderIdAndSession(BaseFolderId folderId, MailboxSession mailboxSession, IdConverter converter) { if (folderId != null) { return(converter.ConvertFolderIdToIdAndSession(folderId, IdConverter.ConvertOption.IgnoreChangeKey)); } return(new IdAndSession(mailboxSession.GetDefaultFolderId(DefaultFolderType.AllItems), mailboxSession)); }
private static StoreObjectId TryGetDefaultFolderId(MailboxSession session, DefaultFolderType type) { if (session == null) { throw new ArgumentNullException("session"); } return(session.GetDefaultFolderId(type)); }
private StoreId GetDefaultFolderId(MailboxSession mailboxSession) { if (this.folderId == null) { this.folderId = mailboxSession.GetDefaultFolderId(this.folderType); } return(this.folderId); }
protected override void LoadViewState() { OwaStoreObjectId owaStoreObjectId = OwaStoreObjectId.CreateFromString(Utilities.GetQueryStringParameter(base.Request, "id")); MailboxSession mailboxSession = (MailboxSession)owaStoreObjectId.GetSession(base.UserContext); StoreObjectId defaultFolderId = mailboxSession.GetDefaultFolderId(DefaultFolderType.RecoverableItemsDeletions); if (defaultFolderId == null) { DumpsterFolderHelper.CheckAndCreateFolder(mailboxSession); defaultFolderId = mailboxSession.GetDefaultFolderId(DefaultFolderType.RecoverableItemsDeletions); } OwaStoreObjectId folderId = OwaStoreObjectId.CreateFromStoreObjectId(defaultFolderId, owaStoreObjectId); this.folder = Utilities.GetFolderForContent <Folder>(base.UserContext, folderId, RecoverDeletedItems.folderProperties); this.viewWidth = Utilities.GetFolderProperty <int>(this.folder, ViewStateProperties.ViewWidth, 450); this.viewHeight = Utilities.GetFolderProperty <int>(this.folder, ViewStateProperties.ViewHeight, 250); }
public static StoreObjectId GetBirthdayCalendarFolderId(MailboxSession session) { ExTraceGlobals.BirthdayCalendarTracer.TraceDebug <Guid>(0L, "BirthdayCalendar::GetBirthdayCalendarFolderId. GetDefaultFolderId. MailboxGuid:{0}", session.MailboxGuid); StoreObjectId defaultFolderId = session.GetDefaultFolderId(DefaultFolderType.BirthdayCalendar); ExTraceGlobals.BirthdayCalendarTracer.TraceDebug <StoreObjectId, Guid>(0L, "BirthdayCalendar::GetBirthdayCalendarFolderId. FolderId: {0} MailboxGuid:{1}", defaultFolderId, session.MailboxGuid); return(defaultFolderId); }
public static TaskGroup Create(MailboxSession session) { Util.ThrowOnNullArgument(session, "session"); TaskGroup taskGroup = ItemBuilder.CreateNewItem <TaskGroup>(session, session.GetDefaultFolderId(DefaultFolderType.CommonViews), ItemCreateInfo.TaskGroupInfo, CreateMessageType.Associated); taskGroup.MailboxSession = session; return(taskGroup); }
// Token: 0x06000783 RID: 1923 RVA: 0x0003546C File Offset: 0x0003366C private static bool ShouldIgnoreMessage(MailboxSession itemStore, StoreObjectId folderId, MeetingMessage mtgMessage) { foreach (DefaultFolderType defaultFolderType in CalendarAssistant.FoldersToIgnore) { StoreObjectId defaultFolderId = itemStore.GetDefaultFolderId(defaultFolderType); if (defaultFolderId != null && defaultFolderId.Equals(folderId)) { return(true); } } StoreObjectId defaultFolderId2 = itemStore.GetDefaultFolderId(DefaultFolderType.DeletedItems); if (defaultFolderId2 != null && defaultFolderId2.Equals(folderId) && mtgMessage != null && mtgMessage is MeetingRequest) { return(!OldMessageDeletion.IsSelfForwardedEvent(mtgMessage, itemStore)); } return(CalendarAssistant.IsDumpsterFolder(itemStore, folderId)); }