// Token: 0x06002F18 RID: 12056 RVA: 0x0010F830 File Offset: 0x0010DA30 internal void GetCache(TextWriter writer, OwaContext owaContext, UserContext userContext) { ExTraceGlobals.MailCallTracer.TraceDebug((long)this.GetHashCode(), "RecipientWellEventHandler.GetCache"); RecipientCache recipientCache = AutoCompleteCache.TryGetCache(userContext); if (recipientCache != null) { recipientCache.Sort(); bool flag = false; if (!userContext.IsFeatureEnabled(Feature.Contacts)) { flag = true; } bool flag2 = false; for (int i = 0; i < recipientCache.CacheLength; i++) { if (!flag || recipientCache.CacheEntries[i].AddressOrigin != AddressOrigin.Store) { if (flag2) { writer.Write(","); } flag2 = true; AutoCompleteCacheEntry.RenderEntryJavascript(writer, recipientCache.CacheEntries[i]); } } } }
// Token: 0x060004C5 RID: 1221 RVA: 0x00027B38 File Offset: 0x00025D38 private void RenderMrr(TextWriter writer) { if (writer == null) { throw new ArgumentNullException("writer"); } RecipientCache recipientCache = AutoCompleteCache.TryGetCache(base.OwaContext.UserContext, false); if (recipientCache != null) { recipientCache.SortByDisplayName(); writer.Write("<tr><td class=\"lt\">"); MRRSelect.Render(MRRSelect.Type.CalendarRecipients, recipientCache, writer); writer.Write("</td></tr>"); } RecipientCache recipientCache2 = RoomsCache.TryGetCache(base.OwaContext.UserContext, false); if (recipientCache2 != null) { recipientCache2.SortByDisplayName(); writer.Write("<tr><td class=\"lt\">"); MRRSelect.Render(MRRSelect.Type.Resources, recipientCache2, writer); writer.Write("</td></tr>"); } }
protected bool GetExchangeParticipantsFromRecipientInfo(RecipientInfo recipientInfo, List <Participant> exchangeParticipants) { bool flag = false; Participant item = null; this.AnrOptions.ResolveContactsFirst = base.UserContext.UserOptions.CheckNameInContactsFirst; if (recipientInfo.PendingChunk != null) { RecipientCache recipientCache = AutoCompleteCache.TryGetCache(OwaContext.Current.UserContext); ArrayList arrayList = new ArrayList(); RecipientWell.ResolveAndRenderChunk(this.Writer, recipientInfo.PendingChunk, arrayList, recipientCache, base.UserContext, this.AnrOptions); for (int i = 0; i < arrayList.Count; i++) { RecipientWellNode recipientWellNode = (RecipientWellNode)arrayList[i]; flag |= Utilities.CreateExchangeParticipant(out item, recipientWellNode.DisplayName, recipientWellNode.RoutingAddress, recipientWellNode.RoutingType, recipientWellNode.AddressOrigin, recipientWellNode.StoreObjectId, recipientWellNode.EmailAddressIndex); exchangeParticipants.Add(item); } } else { flag |= recipientInfo.ToParticipant(out item); exchangeParticipants.Add(item); } return(flag); }
public void GetCache() { if (base.UserContext.CanActAsOwner) { RecipientCache.RunGetCacheOperationUnderDefaultExceptionHandler(delegate { this.GetCache(this.Writer, base.OwaContext, base.UserContext); }, this.GetHashCode()); } }
public void DeleteFromCache() { ExTraceGlobals.MailCallTracer.TraceDebug((long)this.GetHashCode(), "RecipientWellEventHandler.DeleteFromCache"); string email = (string)base.GetParameter("em"); string id = (string)base.GetParameter("id"); RecipientCache recipientCache = AutoCompleteCache.TryGetCache(base.OwaContext.UserContext); if (recipientCache != null) { recipientCache.RemoveEntry(email, id); } }
private void RenderMostRecentRecipients(TextWriter writer) { if (writer == null) { throw new ArgumentNullException("writer"); } RecipientCache recipientCache = AutoCompleteCache.TryGetCache(base.OwaContext.UserContext, false); if (recipientCache != null) { recipientCache.SortByDisplayName(); MRRSelect.Render(MRRSelect.Type.MessageRecipients, recipientCache, writer); } }
// Token: 0x06002F16 RID: 12054 RVA: 0x0010F73C File Offset: 0x0010D93C private void ResolveIndividualWell(string name, AnrManager.Options anrOptions) { string[] array = (string[])base.GetParameter(name); if (array == null) { return; } anrOptions.ResolveContactsFirst = base.UserContext.UserOptions.CheckNameInContactsFirst; if (name == "From") { anrOptions.ResolveOnlyFromAddressBook = true; } this.Writer.Write("<div id=\"{0}\">", name); RecipientCache recipientCache = AutoCompleteCache.TryGetCache(OwaContext.Current.UserContext); for (int i = 0; i < array.Length; i++) { RecipientWell.ResolveAndRenderChunk(this.Writer, array[i], null, recipientCache, base.UserContext, anrOptions); } this.Writer.Write("</div>"); }
protected bool AddFromRecipient(MessageItem message) { bool flag = false; bool flag2 = false; List <Participant> list = new List <Participant>(); RecipientInfo recipientInfo = (RecipientInfo)base.GetParameter("From"); if (recipientInfo != null) { flag |= base.GetExchangeParticipantsFromRecipientInfo(recipientInfo, list); if (list.Count == 1) { message.From = list[0]; SubscriptionCacheEntry subscriptionCacheEntry; if (RecipientCache.RunGetCacheOperationUnderDefaultExceptionHandler(delegate { SubscriptionCache.GetCache(base.UserContext); }, this.GetHashCode()) && base.UserContext.SubscriptionCache.TryGetEntry(message.From, out subscriptionCacheEntry)) { flag2 = true; message[MessageItemSchema.SharingInstanceGuid] = subscriptionCacheEntry.Id; message[ItemSchema.SentRepresentingEmailAddress] = subscriptionCacheEntry.Address; message[ItemSchema.SentRepresentingDisplayName] = subscriptionCacheEntry.DisplayName; } if (!flag2) { this.fromParticipant = message.From; } } } else { message.From = null; } return(flag); }
public static void Render(MRRSelect.Type type, RecipientCache recipientCache, TextWriter writer) { if (recipientCache == null) { throw new ArgumentNullException("recipientCache"); } if (writer == null) { throw new ArgumentNullException("writer"); } int value = 3; int value2 = 19; int value3 = 1; bool flag = false; string value4 = "selmrr"; if (type == MRRSelect.Type.CalendarRecipients) { value = 2; } else if (type == MRRSelect.Type.Resources) { value = 2; value2 = 10; value3 = 3; flag = true; value4 = "selmrs"; } writer.Write("<table cellspacing=4 cellpadding=0 class=\"rcntRcpt\">"); if (type != MRRSelect.Type.Resources) { writer.Write("<tr><td colspan="); writer.Write(value); writer.Write(" class=\"hd\">"); writer.Write("<label for=selmrr>"); writer.Write(LocalizedStrings.GetHtmlEncoded(131996110)); writer.Write("</label></td></tr>"); } writer.Write("<tr><td colspan="); writer.Write(value); writer.Write(" class=\""); bool flag2 = false; if (recipientCache.CacheLength > 0) { bool flag3 = false; for (int i = 0; i < recipientCache.CacheLength; i++) { bool flag4 = (recipientCache.CacheEntries[i].RecipientFlags & 2) != 0; if (flag4 == flag) { flag2 = true; if (!flag3) { writer.Write("sl\"><select size="); writer.Write(value2); writer.Write(" id=\""); writer.Write(value4); writer.Write("\""); if (type == MRRSelect.Type.Resources) { writer.Write(" title=\""); writer.Write(LocalizedStrings.GetHtmlEncoded(1734490793)); writer.Write("\""); } writer.Write(" multiple onkeyup=\"return onKUMRR("); writer.Write(value3); writer.Write(", event);\" onDblClick=\"return onDbClkAddMRR("); writer.Write(value3); writer.Write(");\">"); flag3 = true; } MRRSelect.RenderMostRecentRecipientEntry(writer, recipientCache.CacheEntries[i]); } } if (flag3) { writer.Write("</select>"); } } if (!flag2) { writer.Write("msg\" align=\"center\">"); if (type == MRRSelect.Type.Resources) { writer.Write(LocalizedStrings.GetHtmlEncoded(-821027971)); } else { writer.Write(LocalizedStrings.GetHtmlEncoded(-320187802)); } } writer.Write("</td></tr><tr>"); switch (type) { case MRRSelect.Type.CalendarRecipients: MRRSelect.RenderButton(956546969, RecipientItemType.To, writer); MRRSelect.RenderButton(401962758, RecipientItemType.Cc, writer); break; case MRRSelect.Type.Resources: writer.Write("<td class=\"w50\"> </td>"); MRRSelect.RenderButton(2051574762, RecipientItemType.Bcc, writer); break; default: MRRSelect.RenderButton(-269710455, RecipientItemType.To, writer); MRRSelect.RenderButton(2055888382, RecipientItemType.Cc, writer); MRRSelect.RenderButton(198978688, RecipientItemType.Bcc, writer); break; } writer.Write("</tr>"); if (type == MRRSelect.Type.MessageRecipients && flag2) { writer.Write("<tr><td colspan="); writer.Write(value); writer.Write(" class=\"drp\">"); writer.Write(LocalizedStrings.GetHtmlEncoded(-290151629)); writer.Write("</td></tr>"); } writer.Write("</table>"); }
// 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>"); }
// Token: 0x06001E90 RID: 7824 RVA: 0x000B01A8 File Offset: 0x000AE3A8 internal static void ResolveAndRenderChunk(TextWriter writer, string chunk, ArrayList wellNodes, RecipientCache recipientCache, UserContext userContext, bool resolveAgainstContactsFirst) { RecipientWell.ResolveAndRenderChunk(writer, chunk, wellNodes, recipientCache, userContext, new AnrManager.Options { ResolveContactsFirst = resolveAgainstContactsFirst }); }
public void Get() { ExTraceGlobals.MailCallTracer.TraceDebug((long)this.GetHashCode(), "ClientCacheEventHandler.Get"); base.ResponseContentType = OwaEventContentType.Javascript; this.Writer.WriteLine("{"); this.Writer.Write("sAcc : \""); using (RecipientWellEventHandler recipientWellObject = new RecipientWellEventHandler()) { RecipientCache.RunGetCacheOperationUnderDefaultExceptionHandler(delegate { using (TextWriter textWriter = new StringWriter(CultureInfo.InvariantCulture)) { recipientWellObject.GetCache(textWriter, this.OwaContext, this.UserContext); Utilities.JavascriptEncode(textWriter.ToString(), this.Writer); } }, this.GetHashCode()); } this.Writer.WriteLine("\","); this.Writer.Write("sPr : \""); RecipientCache.RunGetCacheOperationUnderDefaultExceptionHandler(delegate { RecipientInfoCacheEntry entry = AutoCompleteCacheEntry.ParseLogonExchangePrincipal(base.UserContext.ExchangePrincipal, base.UserContext.SipUri, base.UserContext.MobilePhoneNumber); using (TextWriter textWriter = new StringWriter(CultureInfo.InvariantCulture)) { AutoCompleteCacheEntry.RenderEntryJavascript(textWriter, entry); Utilities.JavascriptEncode(textWriter.ToString(), this.Writer); } }, this.GetHashCode()); this.Writer.WriteLine("\","); RecipientCache.RunGetCacheOperationUnderDefaultExceptionHandler(delegate { SubscriptionCache cache = SubscriptionCache.GetCache(base.UserContext); SendAddressDefaultSetting sendAddressDefaultSetting = new SendAddressDefaultSetting(base.UserContext); SubscriptionCacheEntry subscriptionCacheEntry; if (cache.TryGetSendAsDefaultEntry(sendAddressDefaultSetting, out subscriptionCacheEntry)) { this.Writer.Write("sDfltFr : \""); using (TextWriter textWriter = new StringWriter(CultureInfo.InvariantCulture)) { subscriptionCacheEntry.RenderToJavascript(textWriter); Utilities.JavascriptEncode(textWriter.ToString(), this.Writer); } this.Writer.WriteLine("\","); } }, this.GetHashCode()); this.Writer.Write("sSc : \""); RecipientCache.RunGetCacheOperationUnderDefaultExceptionHandler(delegate { SubscriptionCache cache = SubscriptionCache.GetCache(base.UserContext); using (TextWriter textWriter = new StringWriter(CultureInfo.InvariantCulture)) { cache.RenderToJavascript(textWriter); Utilities.JavascriptEncode(textWriter.ToString(), this.Writer); } }, this.GetHashCode()); this.Writer.WriteLine("\","); this.Writer.Write("sMruc : \""); RecipientCache.RunGetCacheOperationUnderDefaultExceptionHandler(delegate { SendFromCache sendFromCache = SendFromCache.TryGetCache(base.UserContext); if (sendFromCache != null) { using (TextWriter textWriter = new StringWriter()) { sendFromCache.RenderToJavascript(textWriter); Utilities.JavascriptEncode(textWriter.ToString(), this.Writer); } } }, this.GetHashCode()); this.Writer.WriteLine("\","); this.Writer.Write("sLng : '"); Utilities.JavascriptEncode(base.UserContext.UserCulture.Name, this.Writer); this.Writer.WriteLine("',"); this.Writer.Write("iThmId : "); this.Writer.Write(ThemeManager.GetIdFromStorageId(base.UserContext.UserOptions.ThemeStorageId)); this.Writer.WriteLine(","); this.Writer.Write("sSigHtml : '"); RenderingUtilities.RenderSignature(this.Writer, base.UserContext, true); this.Writer.WriteLine("',"); this.Writer.Write("sSigTxt : '"); RenderingUtilities.RenderSignature(this.Writer, base.UserContext, false); this.Writer.WriteLine("',"); this.Writer.Write("fSig : "); this.Writer.Write((base.UserContext.IsFeatureEnabled(Feature.Signature) && base.UserContext.UserOptions.AutoAddSignature) ? 1 : 0); this.Writer.WriteLine(","); this.Writer.Write("fSp : '"); this.Writer.Write(base.UserContext.IsFeatureEnabled(Feature.SpellChecker)); this.Writer.WriteLine("',"); this.Writer.Write("iSp : '"); this.Writer.Write(base.UserContext.UserOptions.SpellingDictionaryLanguage); this.Writer.WriteLine("',"); this.Writer.Write("fSpSn : "); this.Writer.Write(base.UserContext.UserOptions.SpellingCheckBeforeSend ? 1 : 0); this.Writer.WriteLine(","); this.Writer.Write("iFmtBrSt : "); this.Writer.Write((int)base.UserContext.UserOptions.FormatBarState); this.Writer.WriteLine(","); this.Writer.Write("sMruFnts : '"); Utilities.JavascriptEncode(base.UserContext.UserOptions.MruFonts, this.Writer); this.Writer.WriteLine("',"); this.Writer.Write("sInitFntNm : '"); Utilities.JavascriptEncode(base.UserContext.UserOptions.ComposeFontName, this.Writer); this.Writer.WriteLine("',"); this.Writer.Write("sInitFntSz : '"); this.Writer.Write(base.UserContext.UserOptions.ComposeFontSize); this.Writer.WriteLine("',"); this.Writer.Write("sDefFntStyl : '"); RenderingUtilities.RenderDefaultFontStyle(this.Writer, base.UserContext); this.Writer.WriteLine("',"); this.Writer.Write("fDefFntBold : "); this.Writer.Write((int)(base.UserContext.UserOptions.ComposeFontFlags & FontFlags.Bold)); this.Writer.WriteLine(","); this.Writer.Write("fDefFntItalc : "); this.Writer.Write((int)(base.UserContext.UserOptions.ComposeFontFlags & FontFlags.Italic)); this.Writer.WriteLine(","); this.Writer.Write("fDefFntUndl : "); this.Writer.Write((int)(base.UserContext.UserOptions.ComposeFontFlags & FontFlags.Underline)); this.Writer.WriteLine(","); this.Writer.Write("fTxt : "); this.Writer.Write((int)base.UserContext.UserOptions.ComposeMarkup); this.Writer.WriteLine(","); this.Writer.Write("fShwBcc : "); this.Writer.Write(base.UserContext.UserOptions.AlwaysShowBcc ? 1 : 0); this.Writer.WriteLine(","); this.Writer.Write("fShwFrm : "); this.Writer.Write(base.UserContext.UserOptions.AlwaysShowFrom ? 1 : 0); this.Writer.WriteLine(","); this.Writer.Write("fAEnc : "); this.Writer.Write(OwaRegistryKeys.AlwaysEncrypt ? 1 : 0); this.Writer.WriteLine(","); this.Writer.Write("fASgn : "); this.Writer.Write(OwaRegistryKeys.AlwaysSign ? 1 : 0); this.Writer.WriteLine(","); this.Writer.Write("fSgn : "); this.Writer.Write(base.UserContext.UserOptions.SmimeSign ? 1 : 0); this.Writer.WriteLine(","); this.Writer.Write("fEnc : "); this.Writer.Write(base.UserContext.UserOptions.SmimeEncrypt ? 1 : 0); this.Writer.WriteLine(","); this.Writer.Write("fMstUpd : "); this.Writer.WriteLine(OwaRegistryKeys.ForceSMimeClientUpgrade ? 1 : 0); this.Writer.WriteLine(","); this.Writer.Write("oMailTipsConfig : {"); this.Writer.Write("'fHideByDefault' : "); this.Writer.Write(base.UserContext.UserOptions.HideMailTipsByDefault ? 1 : 0); RecipientCache.RunGetCacheOperationUnderDefaultExceptionHandler(delegate { CachedOrganizationConfiguration instance = CachedOrganizationConfiguration.GetInstance(base.UserContext.ExchangePrincipal.MailboxInfo.OrganizationId, CachedOrganizationConfiguration.ConfigurationTypes.All); this.Writer.Write(","); this.Writer.Write("'fEnabled' : "); this.Writer.Write(instance.OrganizationConfiguration.Configuration.MailTipsAllTipsEnabled ? 1 : 0); this.Writer.Write(","); this.Writer.Write("'fMailboxEnabled' : "); this.Writer.Write(instance.OrganizationConfiguration.Configuration.MailTipsMailboxSourcedTipsEnabled ? 1 : 0); this.Writer.Write(","); this.Writer.Write("'fGroupMetricsEnabled' : "); this.Writer.Write(instance.OrganizationConfiguration.Configuration.MailTipsGroupMetricsEnabled ? 1 : 0); this.Writer.Write(","); this.Writer.Write("'fExternalEnabled' : "); this.Writer.Write(instance.OrganizationConfiguration.Configuration.MailTipsExternalRecipientsTipsEnabled ? 1 : 0); this.Writer.Write(","); this.Writer.Write("'iLargeAudienceThreshold' : "); this.Writer.Write(instance.OrganizationConfiguration.Configuration.MailTipsLargeAudienceThreshold); }, this.GetHashCode()); this.Writer.Write("}"); this.Writer.Write("}"); }
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 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); } }
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); } }
// 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); } } }