// Token: 0x06001E91 RID: 7825 RVA: 0x000B01D0 File Offset: 0x000AE3D0 internal static void ResolveAndRenderChunk(TextWriter writer, string chunk, ArrayList wellNodes, RecipientCache recipientCache, UserContext userContext, AnrManager.Options options) { if (writer == null) { throw new ArgumentNullException("writer"); } if (chunk == null) { throw new ArgumentNullException("chunk"); } if (userContext == null) { throw new ArgumentNullException("userContext"); } writer.Write("<div id=\"chk\">"); string[] array = Utilities.ParseRecipientChunk(chunk); if (array != null) { for (int i = 0; i < array.Length; i++) { string text = array[i].Trim(); if (text.IndexOf(Globals.HtmlDirectionCharacterString, StringComparison.Ordinal) != -1) { text = Utilities.RemoveHTMLDirectionCharacters(text); } if (text.Length > 0) { RecipientAddress recipientAddress = AnrManager.ResolveAnrString(text, options, userContext); RecipientWellNode recipientWellNode = new RecipientWellNode(text, null); if (recipientAddress != null) { recipientWellNode.DisplayName = recipientAddress.DisplayName; recipientWellNode.SmtpAddress = recipientAddress.SmtpAddress; recipientWellNode.AddressOrigin = recipientAddress.AddressOrigin; recipientWellNode.RoutingAddress = recipientAddress.RoutingAddress; recipientWellNode.RoutingType = recipientAddress.RoutingType; recipientWellNode.RecipientFlags = recipientAddress.RecipientFlags; recipientWellNode.StoreObjectId = recipientAddress.StoreObjectId; recipientWellNode.EmailAddressIndex = recipientAddress.EmailAddressIndex; recipientWellNode.ADObjectId = recipientAddress.ADObjectId; recipientWellNode.SipUri = recipientAddress.SipUri; recipientWellNode.MobilePhoneNumber = recipientAddress.MobilePhoneNumber; } if ((recipientWellNode.RoutingAddress != null || Utilities.IsMapiPDL(recipientWellNode.RoutingType)) && recipientCache != null) { string itemId = string.Empty; if (recipientWellNode.StoreObjectId != null) { itemId = recipientWellNode.StoreObjectId.ToBase64String(); } else if (recipientWellNode.ADObjectId != null) { itemId = Convert.ToBase64String(recipientWellNode.ADObjectId.ObjectGuid.ToByteArray()); } recipientCache.AddEntry(recipientWellNode.DisplayName, recipientWellNode.SmtpAddress, recipientWellNode.RoutingAddress, string.Empty, recipientWellNode.RoutingType, recipientWellNode.AddressOrigin, recipientWellNode.RecipientFlags, itemId, recipientWellNode.EmailAddressIndex, recipientWellNode.SipUri, recipientWellNode.MobilePhoneNumber); } recipientWellNode.Render(writer, userContext, RecipientWellNode.RenderFlags.RenderSkinnyHtml); if (wellNodes != null) { wellNodes.Add(recipientWellNode); } } } } writer.Write("</div>"); }
private void ProcessMessageRequest(MessageAction action) { bool flag = false; MessageItem messageItem = null; bool flag2 = base.IsParameterSet("Id"); bool flag3 = false; RecipientInfoAC[] array = (RecipientInfoAC[])base.GetParameter("Recips"); if (array != null && array.Length != 0) { AutoCompleteCache.UpdateAutoCompleteCacheFromRecipientInfoList(array, base.OwaContext.UserContext); } try { messageItem = this.GetMessageItem(flag2); base.SaveHideMailTipsByDefault(); switch (action) { case MessageAction.Send: case MessageAction.Save: { StoreObjectType storeObjectType = StoreObjectType.Message; if (ObjectClass.IsMeetingRequest(messageItem.ClassName) || ObjectClass.IsMeetingCancellation(messageItem.ClassName) || ObjectClass.IsMeetingResponse(messageItem.ClassName)) { storeObjectType = StoreObjectType.MeetingMessage; } flag = base.UpdateMessage(messageItem, storeObjectType); break; } case MessageAction.SendMime: case MessageAction.SaveMime: this.ImportMessageMime(messageItem); flag3 = (base.IsParameterSet("SavToSnt") && !(bool)base.GetParameter("SavToSnt")); if (action == MessageAction.SendMime && base.IsParameterSet("Encrypted") && (bool)base.GetParameter("Encrypted") && base.IsParameterSet("DavSubmitData")) { messageItem[MessageItemSchema.DavSubmitData] = (string)base.GetParameter("DavSubmitData"); } else { base.UpdateRecipients(messageItem); } break; } if (action == MessageAction.Save || action == MessageAction.SaveMime) { ExTraceGlobals.MailTracer.TraceDebug((long)this.GetHashCode(), "Saving message"); Utilities.SaveItem(messageItem, flag2); base.WriteIdAndChangeKey(messageItem, flag2); if (!flag2 && ExTraceGlobals.MailDataTracer.IsTraceEnabled(TraceType.DebugTrace)) { ExTraceGlobals.MailDataTracer.TraceDebug <string>((long)this.GetHashCode(), "EditMessageEventHandler.ProcessMessageRequest - New message ID is '{0}'", messageItem.Id.ObjectId.ToBase64String()); } } else if (action == MessageAction.Send || action == MessageAction.SendMime) { if (flag) { throw new OwaEventHandlerException("Unresolved recipients", LocalizedStrings.GetNonEncoded(2063734279)); } RightsManagedMessageItem rightsManagedMessageItem = messageItem as RightsManagedMessageItem; bool flag4 = rightsManagedMessageItem != null && rightsManagedMessageItem.Restriction != null; if (messageItem.Recipients.Count == 0 && (action == MessageAction.Send || action != MessageAction.SendMime || !base.IsParameterSet("Encrypted") || !(bool)base.GetParameter("Encrypted"))) { throw new OwaEventHandlerException("No recipients", LocalizedStrings.GetNonEncoded(1878192149)); } if (Utilities.RecipientsOnlyHaveEmptyPDL <Recipient>(base.UserContext, messageItem.Recipients)) { base.RenderPartialFailure(1389137820); } else { ExTraceGlobals.MailTracer.TraceDebug((long)this.GetHashCode(), "Sending message"); try { if (flag3) { messageItem.SendWithoutSavingMessage(); } else { messageItem.Send(); } if (null != base.FromParticipant) { Participant v = new Participant(base.UserContext.ExchangePrincipal); if (!base.FromParticipant.AreAddressesEqual(v)) { RecipientInfoCacheEntry fromRecipientEntry = base.GetFromRecipientEntry(base.FromParticipant.EmailAddress); if (fromRecipientEntry != null) { RecipientCache recipientCache = SendFromCache.TryGetCache(base.UserContext); if (recipientCache != null) { recipientCache.AddEntry(fromRecipientEntry); } } } } } catch (Exception ex) { ExTraceGlobals.MailDataTracer.TraceError <string>((long)this.GetHashCode(), "EditMessageEventHandler.ProcessMessageRequestmessage - Exception: {0}", ex.Message); if (Utilities.ShouldSendChangeKeyForException(ex)) { ExTraceGlobals.MailDataTracer.TraceDebug <string>((long)this.GetHashCode(), "EditMessageEventHandler.ProcessMessageRequestmessage attempt to send change key on exception: {0}", ex.Message); base.SaveIdAndChangeKeyInCustomErrorInfo(messageItem); } throw; } if (Globals.ArePerfCountersEnabled) { OwaSingleCounters.MessagesSent.Increment(); if (flag4) { OwaSingleCounters.IRMMessagesSent.Increment(); } } } } } finally { if (messageItem != null) { messageItem.Dispose(); messageItem = null; } } }
public static void AddRecipientsToDraft(string[] ids, Item draft, RecipientItemType type, UserContext userContext) { if (draft == null) { throw new ArgumentNullException("draft"); } MessageItem messageItem = draft as MessageItem; CalendarItemBase calendarItemBase = draft as CalendarItemBase; if (messageItem == null && calendarItemBase == null) { throw new ArgumentException("The draft should be a MessageItem or a CalendarItemBase while it is now a " + draft.GetType().Name); } if (userContext == null) { throw new ArgumentNullException("usercontext"); } if (ids == null || ids.Length == 0) { throw new ArgumentException("ids is null or empty.", "ids"); } IRecipientSession recipientSession = Utilities.CreateADRecipientSession(ConsistencyMode.IgnoreInvalid, userContext); SortBy sortBy = new SortBy(ADRecipientSchema.DisplayName, SortOrder.Descending); RecipientCache recipientCache = AutoCompleteCache.TryGetCache(OwaContext.Current.UserContext); for (int i = 0; i < ids.Length; i++) { Guid guidFromBase64String = Utilities.GetGuidFromBase64String(ids[i]); QueryFilter filter = new ComparisonFilter(ComparisonOperator.Equal, ADObjectSchema.Guid, guidFromBase64String); ADRecipient[] array = recipientSession.Find(null, QueryScope.SubTree, filter, sortBy, 1); if (array != null && array.Length != 0) { Participant participant = new Participant(array[0]); if (participant != null) { AddressBookHelper.AddParticipantToItem(draft, type, participant); int recipientFlags = 0; if (draft is CalendarItem && DirectoryAssistance.IsADRecipientRoom(array[0])) { recipientFlags = 2; } if (recipientCache != null && userContext.UserOptions.AddRecipientsToAutoCompleteCache) { string participantProperty = Utilities.GetParticipantProperty <string>(participant, ParticipantSchema.SmtpAddress, null); recipientCache.AddEntry(array[0].DisplayName, participantProperty, array[0].LegacyExchangeDN, string.Empty, "EX", AddressOrigin.Directory, recipientFlags, null, EmailAddressIndex.None); } } } } if (recipientCache != null && recipientCache.IsDirty) { recipientCache.Commit(true); } if (messageItem != null) { AddressBookHelper.SaveItem(draft); return; } if (calendarItemBase != null) { EditCalendarItemHelper.CreateUserContextData(userContext, calendarItemBase); } }
public static void AddContactsToDraft(Item draft, RecipientItemType type, UserContext userContext, params string[] ids) { if (draft == null) { throw new ArgumentNullException("draft"); } if (userContext == null) { throw new ArgumentNullException("usercontext"); } if (ids == null || ids.Length == 0) { throw new ArgumentException("ids is null or empty.", "ids"); } Participant participant = null; RecipientCache recipientCache = AutoCompleteCache.TryGetCache(OwaContext.Current.UserContext); int i = 0; while (i < ids.Length) { StoreObjectId storeObjectId = Utilities.CreateStoreObjectId(userContext.MailboxSession, ids[i]); if (storeObjectId.ObjectType == StoreObjectType.DistributionList) { using (DistributionList item = Utilities.GetItem <DistributionList>(userContext, storeObjectId, new PropertyDefinition[] { StoreObjectSchema.DisplayName })) { participant = item.GetAsParticipant(); goto IL_113; } goto IL_9B; } goto IL_9B; IL_113: if (participant != null) { if (recipientCache != null && userContext.UserOptions.AddRecipientsToAutoCompleteCache) { string participantProperty = Utilities.GetParticipantProperty <string>(participant, ParticipantSchema.SmtpAddress, null); recipientCache.AddEntry(participant.DisplayName, participantProperty, participant.EmailAddress, string.Empty, participant.RoutingType, AddressOrigin.Store, 0, storeObjectId.ToBase64String(), ((StoreParticipantOrigin)participant.Origin).EmailAddressIndex); } AddressBookHelper.AddParticipantToItem(draft, type, participant); participant = null; } i++; continue; IL_9B: using (Contact item2 = Utilities.GetItem <Contact>(userContext, storeObjectId, AddressBookHelper.contactsProperties)) { foreach (KeyValuePair <EmailAddressIndex, Participant> keyValuePair in item2.EmailAddresses) { if (keyValuePair.Value != null && !string.IsNullOrEmpty(keyValuePair.Value.EmailAddress)) { participant = keyValuePair.Value; break; } } } goto IL_113; } if (recipientCache != null && recipientCache.IsDirty) { recipientCache.Commit(true); } CalendarItemBase calendarItemBase = draft as CalendarItemBase; if (calendarItemBase != null) { EditCalendarItemHelper.CreateUserContextData(userContext, calendarItemBase); return; } if (draft is MessageItem) { AddressBookHelper.SaveItem(draft); } }
// Token: 0x060000B0 RID: 176 RVA: 0x000068A0 File Offset: 0x00004AA0 public static void ResolveRecipients(string chunk, ArrayList wellNodes, UserContext userContext, bool resolveAgainstContactsFirst) { if (chunk == null) { throw new ArgumentNullException("chunk"); } if (userContext == null) { throw new ArgumentNullException("userContext"); } string[] array = Utilities.ParseRecipientChunk(chunk); if (array != null) { RecipientCache recipientCache = AutoCompleteCache.TryGetCache(OwaContext.Current.UserContext); for (int i = 0; i < array.Length; i++) { string text = array[i].Trim(); if (text.Length > 0) { RecipientAddress recipientAddress = AnrManager.ResolveAnrString(text, resolveAgainstContactsFirst, userContext); RecipientWellNode recipientWellNode = new RecipientWellNode(text, null); if (recipientAddress != null) { recipientWellNode.DisplayName = recipientAddress.DisplayName; recipientWellNode.SmtpAddress = recipientAddress.SmtpAddress; recipientWellNode.AddressOrigin = recipientAddress.AddressOrigin; recipientWellNode.RoutingAddress = recipientAddress.RoutingAddress; recipientWellNode.RoutingType = recipientAddress.RoutingType; recipientWellNode.RecipientFlags = recipientAddress.RecipientFlags; recipientWellNode.StoreObjectId = recipientAddress.StoreObjectId; recipientWellNode.ADObjectId = recipientAddress.ADObjectId; recipientWellNode.EmailAddressIndex = recipientAddress.EmailAddressIndex; } if ((recipientWellNode.RoutingAddress != null || Utilities.IsMapiPDL(recipientWellNode.RoutingType)) && recipientCache != null) { string itemId = string.Empty; if (recipientWellNode.AddressOrigin == AddressOrigin.Store && recipientWellNode.StoreObjectId != null) { itemId = recipientWellNode.StoreObjectId.ToBase64String(); } else if (recipientWellNode.AddressOrigin == AddressOrigin.Directory && recipientWellNode.ADObjectId != null) { itemId = Convert.ToBase64String(recipientWellNode.ADObjectId.ObjectGuid.ToByteArray()); } if (string.IsNullOrEmpty(recipientWellNode.DisplayName)) { recipientWellNode.DisplayName = recipientWellNode.SmtpAddress; } if (userContext.UserOptions.AddRecipientsToAutoCompleteCache) { recipientCache.AddEntry(recipientWellNode.DisplayName, recipientWellNode.SmtpAddress, recipientWellNode.RoutingAddress, string.Empty, recipientWellNode.RoutingType, recipientWellNode.AddressOrigin, recipientWellNode.RecipientFlags, itemId, recipientWellNode.EmailAddressIndex); } } if (wellNodes != null) { wellNodes.Add(recipientWellNode); } } } if (recipientCache != null && recipientCache.IsDirty) { recipientCache.Commit(true); } } }