Esempio n. 1
0
        private Item BindToItemWithItemClass(StoreObjectId id, string itemClass, PropertyDefinition[] properties)
        {
            Item result;

            if (ObjectClass.IsReport(itemClass))
            {
                result = ReportMessage.Bind(this.mailboxSession, id, properties);
            }
            else if (ObjectClass.IsMessage(itemClass, false))
            {
                result = MessageItem.Bind(this.mailboxSession, id, properties);
            }
            else if (ObjectClass.IsPost(itemClass))
            {
                result = PostItem.Bind(this.mailboxSession, id, properties);
            }
            else if (ObjectClass.IsCalendarItem(itemClass))
            {
                result = CalendarItem.Bind(this.mailboxSession, id, properties);
            }
            else if (ObjectClass.IsMeetingRequest(itemClass))
            {
                result = MeetingRequest.Bind(this.mailboxSession, id, properties);
            }
            else if (ObjectClass.IsMeetingResponse(itemClass))
            {
                result = MeetingResponse.Bind(this.mailboxSession, id, properties);
            }
            else if (ObjectClass.IsMeetingCancellation(itemClass))
            {
                result = MeetingCancellation.Bind(this.mailboxSession, id, properties);
            }
            else if (ObjectClass.IsContact(itemClass))
            {
                result = Contact.Bind(this.mailboxSession, id, properties);
            }
            else if (ObjectClass.IsTask(itemClass))
            {
                Task task = Task.Bind(this.mailboxSession, id, true, properties);
                task.SuppressRecurrenceAdjustment = true;
                result = task;
            }
            else if (ObjectClass.IsDistributionList(itemClass))
            {
                result = DistributionList.Bind(this.mailboxSession, id, properties);
            }
            else if (ObjectClass.IsGenericMessage(itemClass))
            {
                result = MessageItem.Bind(this.mailboxSession, id, properties);
            }
            else
            {
                result = Item.Bind(this.mailboxSession, id, properties);
            }
            return(result);
        }
Esempio n. 2
0
 protected Item BindItem(Item item, ExchangeService service, PropertySet propertySet)
 {
     if (item.GetType() == typeof(Microsoft.Exchange.WebServices.Data.Appointment))
     {
         return(Appointment.Bind(service, item.Id, propertySet));
     }
     else if (item.GetType() == typeof(Microsoft.Exchange.WebServices.Data.Task))
     {
         return(Task.Bind(service, item.Id, propertySet));
     }
     else if (item.GetType() == typeof(Microsoft.Exchange.WebServices.Data.Contact))
     {
         return(Contact.Bind(service, item.Id, propertySet));
     }
     else if (item.GetType() == typeof(Microsoft.Exchange.WebServices.Data.ContactGroup))
     {
         return(ContactGroup.Bind(service, item.Id, propertySet));
     }
     else if (item.GetType() == typeof(Microsoft.Exchange.WebServices.Data.PostItem))
     {
         return(PostItem.Bind(service, item.Id, propertySet));
     }
     else if (item.GetType() == typeof(Microsoft.Exchange.WebServices.Data.MeetingCancellation))
     {
         return(MeetingCancellation.Bind(service, item.Id, propertySet));
     }
     else if (item.GetType() == typeof(Microsoft.Exchange.WebServices.Data.MeetingRequest))
     {
         return(MeetingRequest.Bind(service, item.Id, propertySet));
     }
     else if (item.GetType() == typeof(Microsoft.Exchange.WebServices.Data.MeetingResponse))
     {
         return(MeetingResponse.Bind(service, item.Id, propertySet));
     }
     else if (item.GetType() == typeof(Microsoft.Exchange.WebServices.Data.MeetingMessage))
     {
         return(MeetingMessage.Bind(service, item.Id, propertySet));
     }
     else if (item.GetType() == typeof(Microsoft.Exchange.WebServices.Data.EmailMessage))
     {
         return(EmailMessage.Bind(service, item.Id, propertySet));
     }
     else
     {
         throw new Exception("Unknown Exchange Item type: " + item.GetType().FullName);
     }
 }
Esempio n. 3
0
 internal void CheckAndSubmitMfn(TransportMailItem originalMailItem)
 {
     if (!this.ShouldGenerateMfn())
     {
         return;
     }
     using (MeetingRequest meetingRequest = MeetingRequest.Bind(this.item.Session, this.item.Item.Id))
     {
         using (MeetingForwardNotification meetingForwardNotification = meetingRequest.CreateNotification())
         {
             TransportMailItem transportMailItem = TransportMailItem.NewSideEffectMailItem(originalMailItem, this.submitter.OrganizationId, LatencyComponent.Agent, MailDirectionality.Originating, this.submitter.ExternalOrganizationId);
             transportMailItem.From = RoutingAddress.NullReversePath;
             if (this.TryCreateMfnSubjectAndBody(meetingForwardNotification))
             {
                 Stream stream = transportMailItem.OpenMimeWriteStream();
                 stream.Close();
                 this.CopyMfnRecipientsTo(meetingForwardNotification, transportMailItem);
                 this.CopyMfnContentTo(meetingForwardNotification, transportMailItem);
                 MailboxSession mailboxSession = this.item.Item.Session as MailboxSession;
                 Participant    participant    = Participant.TryConvertTo(this.item.Sender, "SMTP", mailboxSession);
                 if (participant == null)
                 {
                     participant = this.item.Sender;
                 }
                 if (mailboxSession != null)
                 {
                     MfnLog.LogEntry(mailboxSession, string.Format("Decorating MFN with the address - Name {0}, EmailAddress : {1}, RoutingType : {2}", participant.DisplayName, participant.EmailAddress, participant.RoutingType));
                 }
                 Components.DsnGenerator.DecorateMfn(transportMailItem, participant.DisplayName, participant.EmailAddress);
                 this.item.DecorateMessage(transportMailItem);
                 this.item.ApplySecurityAttributesTo(transportMailItem);
                 ClassificationUtils.PromoteStoreClassifications(transportMailItem.RootPart.Headers);
                 this.submitter.StoreDriverSubmission.ThrowIfStopped();
                 transportMailItem.UpdateCachedHeaders();
                 this.submitter.SendMailItem(new SubmissionReadOnlyMailItem(transportMailItem, MailItemType.OtherMessage), null);
             }
         }
     }
 }
        // Token: 0x060007B6 RID: 1974 RVA: 0x0003766C File Offset: 0x0003586C
        internal static void ApplyRollingHighlight(MeetingRequest meetingRequest, string internetMessageId, CalendarItemBase originalCalItem, OldMessageDeletion.LatestItemInfo latestInfo)
        {
            int            i = 3;
            MeetingRequest meetingRequest2 = meetingRequest;

            CalendarAssistant.TracerPfd.TracePfd <int, object, string>(0L, "PFD IWC {0} {1} Applying the rolling highlight to the item{2}", 18583, TraceContext.Get(), internetMessageId);
            if (meetingRequest2 != null)
            {
                int hashCode = meetingRequest.GetHashCode();
                PropertyDefinition changeHighlight = CalendarItemBaseSchema.ChangeHighlight;
                while (i > 0)
                {
                    try
                    {
                        if (meetingRequest2 == null)
                        {
                            meetingRequest2 = MeetingRequest.Bind(meetingRequest.Session, meetingRequest.Id);
                            meetingRequest2.OpenAsReadWrite();
                        }
                        if (latestInfo.RollingHighlight != 0)
                        {
                            int num = (int)Utils.SafeGetProperty(meetingRequest2, changeHighlight, 0);
                            if ((num & 8) == 0 && (latestInfo.RollingHighlight & 8) != 0)
                            {
                                if (!string.IsNullOrEmpty(latestInfo.LatestOldLocationStr))
                                {
                                    meetingRequest2[CalendarItemBaseSchema.OldLocation] = latestInfo.LatestOldLocationStr;
                                }
                                else
                                {
                                    latestInfo.RollingHighlight &= -9;
                                }
                            }
                            if ((num & 3) == 0 && (latestInfo.RollingHighlight & 3) != 0)
                            {
                                if (latestInfo.LatestOldStartTime != ExDateTime.MinValue && latestInfo.LatestOldEndTime != ExDateTime.MinValue)
                                {
                                    meetingRequest2[MeetingRequestSchema.OldStartWhole] = latestInfo.LatestOldStartTime;
                                    meetingRequest2[MeetingRequestSchema.OldEndWhole]   = latestInfo.LatestOldEndTime;
                                }
                                else
                                {
                                    latestInfo.RollingHighlight &= -4;
                                }
                            }
                            num |= latestInfo.RollingHighlight;
                            meetingRequest2[changeHighlight] = num;
                            if (meetingRequest2.MeetingRequestType != MeetingMessageType.PrincipalWantsCopy)
                            {
                                ChangeHighlightHelper changeHighlightHelper = new ChangeHighlightHelper(num);
                                MeetingMessageType    suggestedMeetingType  = changeHighlightHelper.SuggestedMeetingType;
                                meetingRequest2.MeetingRequestType = suggestedMeetingType;
                            }
                        }
                        if (originalCalItem != null && meetingRequest2.MeetingRequestType != MeetingMessageType.NewMeetingRequest && meetingRequest2.MeetingRequestType != MeetingMessageType.PrincipalWantsCopy)
                        {
                            ResponseType responseType = originalCalItem.ResponseType;
                            if (responseType == ResponseType.NotResponded || responseType == ResponseType.None)
                            {
                                meetingRequest2.MeetingRequestType    = MeetingMessageType.FullUpdate;
                                meetingRequest2[ItemSchema.IconIndex] = CalendarItemBase.CalculateMeetingRequestIcon(meetingRequest2);
                            }
                        }
                        if (!meetingRequest2.IsDirty)
                        {
                            break;
                        }
                        ConflictResolutionResult saveResults = meetingRequest2.Save(SaveMode.ResolveConflicts);
                        meetingRequest2.Load();
                        if (CalendarProcessing.CheckSaveResults(meetingRequest2, saveResults, internetMessageId))
                        {
                            break;
                        }
                        i--;
                        if (meetingRequest2 != meetingRequest && meetingRequest2 != null)
                        {
                            meetingRequest2.Dispose();
                        }
                        meetingRequest2 = null;
                    }
                    catch (ObjectExistedException ex)
                    {
                        MailboxSession session = meetingRequest.Session as MailboxSession;
                        OldMessageDeletion.Tracer.TraceError((long)hashCode, "{0}: Exception thrown when rolling forward the change highlight on item: {1}, attempt: {2}, exception = {3}", new object[]
                        {
                            TraceContext.Get(),
                            internetMessageId,
                            4 - i,
                            ex
                        });
                        CalendarAssistantLog.LogEntry(session, ex, false, "Exception thrown when rolling forward the change highlight on item: {0}, attempt: {1}", new object[]
                        {
                            internetMessageId,
                            4 - i
                        });
                        i--;
                        if (meetingRequest2 != meetingRequest && meetingRequest2 != null)
                        {
                            meetingRequest2.Dispose();
                            meetingRequest2 = null;
                        }
                    }
                    catch (SaveConflictException ex2)
                    {
                        MailboxSession session2 = meetingRequest.Session as MailboxSession;
                        OldMessageDeletion.Tracer.TraceError((long)hashCode, "{0}: Exception thrown when rolling forward the change highlight on item: {1}, attempt: {2}, exception = {3}", new object[]
                        {
                            TraceContext.Get(),
                            internetMessageId,
                            4 - i,
                            ex2
                        });
                        CalendarAssistantLog.LogEntry(session2, ex2, false, "Exception thrown when rolling forward the change highlight on item: {0}, attempt: {1}", new object[]
                        {
                            internetMessageId,
                            4 - i
                        });
                        i--;
                        if (meetingRequest2 != meetingRequest && meetingRequest2 != null)
                        {
                            meetingRequest2.Dispose();
                            meetingRequest2 = null;
                        }
                    }
                    catch (ObjectNotFoundException ex3)
                    {
                        MailboxSession session3 = meetingRequest.Session as MailboxSession;
                        OldMessageDeletion.Tracer.TraceError((long)hashCode, "{0}: Exception thrown when rolling forward the change highlight on item: {1},  attempt: {2}, exception = {3}", new object[]
                        {
                            TraceContext.Get(),
                            internetMessageId,
                            4 - i,
                            ex3
                        });
                        CalendarAssistantLog.LogEntry(session3, ex3, false, "Exception thrown when rolling forward the change highlight on item: {0}, attempt: {1}", new object[]
                        {
                            internetMessageId,
                            4 - i
                        });
                        break;
                    }
                    finally
                    {
                        if (meetingRequest2 != meetingRequest && meetingRequest2 != null)
                        {
                            meetingRequest2.Dispose();
                        }
                    }
                }
            }
        }