예제 #1
0
        private void UpdateParticipantsOnCalendarItem(CalendarItemBase calendarItem, bool isReadOnlyItem)
        {
            this.CheckDisposed("ProcessParticipants");
            base.LocationIdentifierHelperInstance.SetLocationIdentifier(62325U, LastChangeAction.ProcessParticipants);
            IAttendeeCollection attendeeCollection = calendarItem.AttendeeCollection;

            calendarItem.LocationIdentifierHelperInstance.SetLocationIdentifier(37749U);
            attendeeCollection.Clear();
            bool flag = false;

            if (base.From != null)
            {
                calendarItem.LocationIdentifierHelperInstance.SetLocationIdentifier(54133U);
                attendeeCollection.Add(base.From, AttendeeType.Required, null, null, false).RecipientFlags = (RecipientFlags.Sendable | RecipientFlags.Organizer);
                flag = true;
            }
            List <BlobRecipient> list = this.GetUnsendableRecipients();

            if (!isReadOnlyItem)
            {
                this.SetUnsendableRecipients(list);
            }
            list = MeetingRequest.MergeRecipientLists(base.Recipients, list);
            Participant participant = null;

            if (base.IsDelegated())
            {
                participant = (Participant)base.TryGetProperty(InternalSchema.ReceivedBy);
            }
            foreach (BlobRecipient blobRecipient in list)
            {
                RecipientFlags valueOrDefault = blobRecipient.GetValueOrDefault <RecipientFlags>(InternalSchema.RecipientFlags);
                bool           flag2          = (valueOrDefault & RecipientFlags.Organizer) == RecipientFlags.Organizer;
                if (flag2)
                {
                    if (flag)
                    {
                        continue;
                    }
                    flag = true;
                }
                if (!blobRecipient.Participant.AreAddressesEqual(base.From))
                {
                    RecipientItemType type         = MapiUtil.MapiRecipientTypeToRecipientItemType(blobRecipient.GetValueOrDefault <RecipientType>(InternalSchema.RecipientType, RecipientType.To));
                    AttendeeType      attendeeType = Attendee.RecipientItemTypeToAttendeeType(type);
                    Participant       participant2 = blobRecipient.Participant;
                    if (participant != null && Participant.HasSameEmail(participant2, participant, base.MailboxSession, true))
                    {
                        calendarItem.LocationIdentifierHelperInstance.SetLocationIdentifier(41845U);
                        attendeeCollection.Add(base.ReceivedRepresenting, attendeeType, null, null, false);
                        participant = null;
                    }
                    else
                    {
                        calendarItem.LocationIdentifierHelperInstance.SetLocationIdentifier(58229U);
                        attendeeCollection.Add(participant2, attendeeType, null, null, false);
                    }
                }
            }
        }
예제 #2
0
        internal List <BlobRecipient> GetMergedRecipientList()
        {
            List <BlobRecipient> unsendableRecipients = this.GetUnsendableRecipients();

            return(MeetingRequest.MergeRecipientLists(base.Recipients, unsendableRecipients));
        }
예제 #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);
        }