protected override void UpdateNewItemProperties() { base.UpdateNewItemProperties(); this.newItem[InternalSchema.Importance] = (Importance)StoreObject.SafePropertyValue(this.originalItem.TryGetProperty(InternalSchema.Importance), typeof(Importance), Importance.Normal); this.newItem[InternalSchema.Codepage] = (int)StoreObject.SafePropertyValue(this.originalItem.TryGetProperty(InternalSchema.Codepage), typeof(int), 0); if (this.originalItem is MeetingRequest || this.originalItem is MeetingCancellation || this.originalItem is CalendarItemBase || base.TreatAsMeetingMessage) { this.newItem.SetOrDeleteProperty(InternalSchema.From, this.originalItem.GetValueOrDefault <Participant>(InternalSchema.From)); this.newItem.SetOrDeleteProperty(InternalSchema.AcceptLanguage, this.originalItem.GetValueOrDefault <string>(InternalSchema.AcceptLanguage)); } this.newItem[InternalSchema.OriginalAuthorName] = string.Empty; }
public static MessageItem CreateNotReadNotification(MessageItem originalItem) { ExDateTime utcNow = ExDateTime.UtcNow; MessageItem messageItem = MessageItem.CreateInMemory(StoreObjectSchema.ContentConversionProperties); messageItem.ClassName = ObjectClass.MakeReportClassName(originalItem.ClassName, "IPNNRN"); messageItem.SafeSetProperty(InternalSchema.ReportTime, utcNow); Participant participant = originalItem.ReadReceiptAddressee; if (null == participant) { if (null != originalItem.Sender) { participant = originalItem.Sender; } else { participant = originalItem.From; } } messageItem.Recipients.Add(participant, RecipientItemType.To); foreach (KeyValuePair <PropertyDefinition, PropertyDefinition> keyValuePair in RuleMessageUtils.NrnPropertyMap) { messageItem.SafeSetProperty(keyValuePair.Key, originalItem.TryGetProperty(keyValuePair.Value)); } BodyWriteConfiguration configuration = new BodyWriteConfiguration(BodyFormat.TextHtml, originalItem.Body.RawCharset.Name); CultureInfo formatProvider; using (Stream stream = messageItem.Body.OpenWriteStream(configuration)) { Charset charset; ReportMessage.GenerateReportBody(messageItem, stream, out formatProvider, out charset); } messageItem.SafeSetProperty(InternalSchema.Subject, ServerStrings.NotRead.ToString(formatProvider) + originalItem.TryGetProperty(InternalSchema.Subject)); byte[] parentBytes = originalItem.TryGetProperty(InternalSchema.ConversationIndex) as byte[]; messageItem.SafeSetProperty(InternalSchema.ConversationIndex, ConversationIndex.CreateFromParent(parentBytes).ToByteArray()); messageItem.SafeSetProperty(InternalSchema.ConversationTopic, StoreObject.SafePropertyValue(originalItem.TryGetProperty(InternalSchema.ConversationTopic), typeof(string), StoreObject.SafePropertyValue(originalItem.TryGetProperty(InternalSchema.NormalizedSubjectInternal), typeof(string), null))); messageItem.SafeSetProperty(InternalSchema.IsReadReceiptRequested, false); messageItem.SafeSetProperty(InternalSchema.IsDeliveryReceiptRequested, false); messageItem.SafeSetProperty(InternalSchema.IsNonDeliveryReceiptRequested, false); messageItem.SafeSetProperty(InternalSchema.NonReceiptReason, 0); messageItem.SafeSetProperty(InternalSchema.DiscardReason, 1); messageItem.SafeSetProperty(InternalSchema.OriginalDeliveryTime, utcNow); return(messageItem); }
protected override void UpdateNewItemProperties() { base.UpdateNewItemProperties(); if ((this.parameters.ForwardCreationFlags & ForwardCreationFlags.PreserveSender) == ForwardCreationFlags.PreserveSender) { PostItem postItem = this.newItem as PostItem; if (postItem != null) { postItem.Sender = ((PostItem)this.originalItem).Sender; } else { ((MessageItem)this.newItem).Sender = ((MessageItem)this.originalItem).Sender; } } this.newItem[InternalSchema.Importance] = (Importance)StoreObject.SafePropertyValue(this.originalItem.TryGetProperty(InternalSchema.Importance), typeof(Importance), Importance.Normal); this.newItem[InternalSchema.OriginalAuthorName] = string.Empty; if (this.originalItem is MeetingRequest || this.originalItem is MeetingCancellation || this.originalItem is CalendarItemBase || base.TreatAsMeetingMessage) { this.newItem.SetOrDeleteProperty(InternalSchema.From, this.originalItem.GetValueOrDefault <Participant>(InternalSchema.From)); this.newItem.SetOrDeleteProperty(InternalSchema.AcceptLanguage, this.originalItem.GetValueOrDefault <string>(InternalSchema.AcceptLanguage)); this.UpdateCalendarProperties(); } }
protected virtual void UpdateNewItemProperties() { IExchangePrincipal exchangePrincipal = (this.newItem.Session == null) ? null : this.newItem.Session.MailboxOwner; MailboxSession mailboxSession = this.newItem.Session as MailboxSession; if (mailboxSession != null && exchangePrincipal != null) { PostItem postItem = this.newItem as PostItem; if (postItem != null) { postItem.Sender = new Participant(exchangePrincipal); } else { ((MessageItem)this.newItem).Sender = new Participant(exchangePrincipal); } } string text = null; string valueOrDefault = this.originalItem.GetValueOrDefault <string>(InternalSchema.InternetMessageId); if (!string.IsNullOrEmpty(valueOrDefault)) { text = valueOrDefault; } string text2 = null; valueOrDefault = this.originalItem.GetValueOrDefault <string>(InternalSchema.InReplyTo); if (!string.IsNullOrEmpty(valueOrDefault)) { text2 = valueOrDefault; } this.newItem.SafeSetProperty(InternalSchema.InReplyTo, text); StringBuilder stringBuilder = new StringBuilder(128); valueOrDefault = this.originalItem.GetValueOrDefault <string>(InternalSchema.InternetReferences); if (!string.IsNullOrEmpty(valueOrDefault)) { stringBuilder.Append(valueOrDefault); } else if (text2 != null) { stringBuilder.Append(text2); } if (text != null) { if (stringBuilder.Length + 1 + text.Length > 32768 || stringBuilder.Length == 0) { stringBuilder.Clear(); stringBuilder.Append(text); } else { stringBuilder.Append(','); stringBuilder.Append(text); } } this.newItem.SafeSetProperty(InternalSchema.InternetReferences, stringBuilder.ToString()); this.newItem.SafeSetProperty(InternalSchema.Categories, StoreObject.SafePropertyValue(this.originalItem.TryGetProperty(InternalSchema.Categories), typeof(string[]), null)); byte[] parentBytes = this.originalItem.TryGetProperty(InternalSchema.ConversationIndex) as byte[]; ConversationIndex conversationIndex = ConversationIndex.CreateFromParent(parentBytes); this.newItem.SafeSetProperty(InternalSchema.ConversationIndex, conversationIndex.ToByteArray()); ConversationId valueOrDefault2 = this.originalItem.GetValueOrDefault <ConversationId>(InternalSchema.ConversationFamilyId); this.newItem.SafeSetProperty(InternalSchema.ConversationFamilyId, valueOrDefault2); object propValue = this.originalItem.TryGetProperty(InternalSchema.SupportsSideConversation); this.newItem.SafeSetProperty(InternalSchema.SupportsSideConversation, propValue); ConversationCreatorSidCalculatorFactory conversationCreatorSidCalculatorFactory = new ConversationCreatorSidCalculatorFactory(XSOFactory.Default); IConversationCreatorSidCalculator conversationCreatorSidCalculator; byte[] propValue2; if (conversationCreatorSidCalculatorFactory.TryCreate(mailboxSession, exchangePrincipal, out conversationCreatorSidCalculator) && conversationCreatorSidCalculator.TryCalculateOnReply(conversationIndex, out propValue2)) { this.newItem.SafeSetProperty(ItemSchema.ConversationCreatorSID, propValue2); } bool?valueAsNullable = this.originalItem.GetValueAsNullable <bool>(InternalSchema.ConversationIndexTracking); if (valueAsNullable != null && valueAsNullable.Value) { this.newItem.SafeSetProperty(InternalSchema.ConversationIndexTracking, true); } this.newItem.SafeSetProperty(InternalSchema.ConversationTopic, StoreObject.SafePropertyValue(this.originalItem.TryGetProperty(InternalSchema.ConversationTopic), typeof(string), StoreObject.SafePropertyValue(this.originalItem.TryGetProperty(InternalSchema.NormalizedSubjectInternal), typeof(string), null))); this.newItem.SafeSetProperty(InternalSchema.Sensitivity, StoreObject.SafePropertyValue(this.originalItem.TryGetProperty(InternalSchema.Sensitivity), typeof(Sensitivity), Sensitivity.Normal)); this.newItem.SafeSetProperty(InternalSchema.OriginalSensitivity, StoreObject.SafePropertyValue(this.originalItem.TryGetProperty(InternalSchema.OriginalSensitivity), typeof(Sensitivity), Sensitivity.Normal)); this.newItem.SafeSetProperty(InternalSchema.IsReadReceiptRequested, false); this.newItem.SafeSetProperty(InternalSchema.IsDeliveryReceiptRequested, false); this.newItem.SafeSetProperty(InternalSchema.IsReplyRequested, StoreObject.SafePropertyValue(this.originalItem.TryGetProperty(InternalSchema.IsReplyRequested), typeof(bool), null)); this.newItem.SafeSetProperty(InternalSchema.IsResponseRequested, StoreObject.SafePropertyValue(this.originalItem.TryGetProperty(InternalSchema.IsResponseRequested), typeof(bool), null)); this.newItem.SafeSetProperty(InternalSchema.NativeBlockStatus, StoreObject.SafePropertyValue(this.originalItem.TryGetProperty(InternalSchema.NativeBlockStatus), typeof(int), null)); object obj = this.originalItem.TryGetProperty(InternalSchema.IconIndex); if (!PropertyError.IsPropertyError(obj)) { IconIndex iconIndex = (IconIndex)obj; if (iconIndex != IconIndex.Default) { iconIndex = ReplyForwardCommon.GetIconIndexForNewItem(iconIndex); this.newItem.SafeSetProperty(InternalSchema.IconIndex, iconIndex); } } ReplyForwardCommon.UpdateXLoop(this.originalItem, this.newItem, this.parameters.XLoop); }