Пример #1
0
        public static MessageItem CreateDelegateForward(MessageItem originalItem, CultureInfo culture, string imceaDomain, string xLoop, IRuleEvaluationContext context)
        {
            Util.ThrowOnNullArgument(originalItem, "originalItem");
            ExTraceGlobals.StorageTracer.Information(0L, "RuleMessageUtils::CreateDelegateForward.");
            MessageItem result;

            using (DisposeGuard disposeGuard = default(DisposeGuard))
            {
                MessageItem messageItem = RuleMessageUtils.CreateRedirect(originalItem, culture, imceaDomain, xLoop, context);
                disposeGuard.Add <MessageItem>(messageItem);
                for (int i = 0; i < RuleMessageUtils.rcvdRepresentingProps.Length; i++)
                {
                    if (originalItem.GetValueOrDefault <object>(RuleMessageUtils.rcvdRepresentingProps[i]) == null)
                    {
                        object valueOrDefault = originalItem.GetValueOrDefault <object>(RuleMessageUtils.rcvdByProps[i]);
                        if (valueOrDefault != null)
                        {
                            messageItem[RuleMessageUtils.rcvdRepresentingProps[i]] = valueOrDefault;
                        }
                    }
                    messageItem.Delete(RuleMessageUtils.rcvdByProps[i]);
                }
                object valueOrDefault2 = originalItem.GetValueOrDefault <object>(InternalSchema.SentRepresentingEntryId);
                if (valueOrDefault2 != null)
                {
                    messageItem[InternalSchema.ReadReceiptEntryId] = valueOrDefault2;
                    messageItem[InternalSchema.ReportEntryId]      = valueOrDefault2;
                }
                disposeGuard.Success();
                result = messageItem;
            }
            return(result);
        }
Пример #2
0
        public static MessageItem CreateSmsAlert(MessageItem originalItem, CultureInfo culture, string imceaDomain, string xLoop, ExTimeZone timeZone, IRuleEvaluationContext context)
        {
            Util.ThrowOnNullArgument(originalItem, "originalItem");
            ExTraceGlobals.StorageTracer.Information(0L, "RuleMessageUtils::CreateSmsAlert.");
            MessageItem messageItem = RuleMessageUtils.CreateForward(originalItem, true, culture, imceaDomain, xLoop, timeZone, context);

            if (messageItem != null)
            {
                messageItem[InternalSchema.ItemClass] = "IPM.Note.Mobile.SMS.Alert";
            }
            return(messageItem);
        }
Пример #3
0
        public static MessageItem CreateForward(MessageItem originalItem, bool asAttachment, CultureInfo culture, string imceaDomain, string xLoop, ExTimeZone timeZone, IRuleEvaluationContext context)
        {
            Util.ThrowOnNullArgument(originalItem, "originalItem");
            Util.ThrowOnNullArgument(culture, "culture");
            Util.ThrowOnNullOrEmptyArgument(imceaDomain, "imceaDomain");
            ExTraceGlobals.StorageTracer.Information(0L, "RuleMessageUtils::CreateForward.");
            MessageItem messageItem = null;
            bool        flag        = false;
            MessageItem result;

            try
            {
                ForwardCreationFlags forwardCreationFlags = ForwardCreationFlags.None;
                string className = originalItem.ClassName;
                if (ObjectClass.IsMeetingMessage(className))
                {
                    forwardCreationFlags |= ForwardCreationFlags.TreatAsMeetingMessage;
                }
                messageItem = context.CreateMessageItem(InternalSchema.ContentConversionProperties);
                messageItem[InternalSchema.ItemClass] = "IPM.Note";
                StoreSession storeSession = context.StoreSession ?? originalItem.Session;
                if (asAttachment)
                {
                    ForwardAsAttachmentCreation forwardAsAttachmentCreation = new ForwardAsAttachmentCreation(originalItem, messageItem, new ReplyForwardConfiguration(forwardCreationFlags, culture)
                    {
                        XLoop    = xLoop,
                        TimeZone = timeZone,
                        ConversionOptionsForSmime = new InboundConversionOptions(storeSession.GetADRecipientSession(true, ConsistencyMode.IgnoreInvalid), imceaDomain)
                    });
                    forwardAsAttachmentCreation.PopulateProperties();
                }
                else
                {
                    bool flag2        = ObjectClass.IsMeetingCancellation(className);
                    bool flag3        = ObjectClass.IsMeetingRequest(className);
                    bool isRestricted = originalItem.IsRestricted;
                    if (flag2)
                    {
                        messageItem[InternalSchema.ItemClass] = "IPM.Schedule.Meeting.Canceled";
                        messageItem[InternalSchema.IconIndex] = IconIndex.AppointmentMeetCancel;
                    }
                    else if (flag3)
                    {
                        messageItem[InternalSchema.ItemClass]           = "IPM.Schedule.Meeting.Request";
                        messageItem[InternalSchema.IsResponseRequested] = true;
                        messageItem[InternalSchema.IsReplyRequested]    = true;
                    }
                    else if (isRestricted)
                    {
                        messageItem[StoreObjectSchema.ContentClass] = "rpmsg.message";
                        messageItem.IconIndex = IconIndex.MailIrm;
                    }
                    BodyFormat format = originalItem.Body.Format;
                    ReplyForwardConfiguration replyForwardConfiguration = new ReplyForwardConfiguration(format, forwardCreationFlags, culture);
                    replyForwardConfiguration.XLoop    = xLoop;
                    replyForwardConfiguration.TimeZone = timeZone;
                    replyForwardConfiguration.ConversionOptionsForSmime = new InboundConversionOptions(storeSession.GetADRecipientSession(true, ConsistencyMode.IgnoreInvalid), imceaDomain);
                    RuleMessageUtils.GenerateHeader(replyForwardConfiguration, originalItem);
                    ForwardCreation forwardCreation = new ForwardCreation(originalItem, messageItem, replyForwardConfiguration);
                    forwardCreation.PopulateProperties();
                    if (flag2 || flag3)
                    {
                        AppointmentStateFlags appointmentStateFlags = messageItem.GetValueOrDefault <AppointmentStateFlags>(InternalSchema.AppointmentState);
                        appointmentStateFlags |= (AppointmentStateFlags.Meeting | AppointmentStateFlags.Received);
                        messageItem[InternalSchema.AppointmentState] = appointmentStateFlags;
                        int num = messageItem.GetValueOrDefault <int>(InternalSchema.AppointmentAuxiliaryFlags, 0);
                        num |= 4;
                        messageItem[InternalSchema.AppointmentAuxiliaryFlags] = num;
                        if (flag3)
                        {
                            List <BlobRecipient> list = BlobRecipientParser.ReadRecipients(originalItem, InternalSchema.UnsendableRecipients);
                            list = MeetingRequest.FilterBlobRecipientList(list);
                            list = MeetingRequest.MergeRecipientLists(originalItem.Recipients, list);
                            list = MeetingRequest.FilterBlobRecipientList(list);
                            BlobRecipientParser.WriteRecipients(messageItem, InternalSchema.UnsendableRecipients, list);
                        }
                    }
                }
                flag   = true;
                result = messageItem;
            }
            finally
            {
                if (!flag && messageItem != null)
                {
                    messageItem.Dispose();
                    messageItem = null;
                }
            }
            return(result);
        }