コード例 #1
0
        // Token: 0x060009F6 RID: 2550 RVA: 0x00045548 File Offset: 0x00043748
        private void CreateAttachmentInfobarHelper(ArrayList attachmentList)
        {
            if (attachmentList == null || attachmentList.Count <= 0)
            {
                return;
            }
            StringBuilder    stringBuilder    = new StringBuilder();
            int              num              = 0;
            UserContext      userContext      = UserContextManager.GetUserContext();
            AttachmentPolicy attachmentPolicy = userContext.AttachmentPolicy;

            foreach (object obj in attachmentList)
            {
                AttachmentWellInfo attachmentWellInfo = (AttachmentWellInfo)obj;
                bool flag = AttachmentUtility.IsWebReadyDocument(attachmentWellInfo.FileExtension, attachmentWellInfo.MimeType);
                if (flag && (attachmentWellInfo.AttachmentLevel == AttachmentPolicy.Level.Block || attachmentPolicy.ForceWebReadyDocumentViewingFirst))
                {
                    this.hasWebReadyFirst = true;
                }
                if (attachmentWellInfo.AttachmentLevel == AttachmentPolicy.Level.Block)
                {
                    this.hasLevelOne = true;
                    if (!flag)
                    {
                        this.hasLevelOneAndBlock = true;
                        num++;
                        if (num == 16)
                        {
                            stringBuilder.Append(",...");
                        }
                        else if (num <= 15)
                        {
                            if (num != 1)
                            {
                                stringBuilder.Append(", ");
                            }
                            stringBuilder.Append(attachmentWellInfo.AttachmentName);
                        }
                    }
                }
                else if (attachmentWellInfo.AttachmentLevel == AttachmentPolicy.Level.ForceSave)
                {
                    this.hasLevelTwo = true;
                }
                else if (attachmentWellInfo.AttachmentLevel == AttachmentPolicy.Level.Allow)
                {
                    this.hasLevelThree = true;
                }
            }
            if (stringBuilder.Length > 0)
            {
                this.fileNameStringForLevelOneAndBlock = stringBuilder.ToString();
            }
        }
コード例 #2
0
        // Token: 0x06001973 RID: 6515 RVA: 0x00094A60 File Offset: 0x00092C60
        private int ConvertToUserTimeZone(int minutesPastMidnight, ExDateTime day)
        {
            if (!this.IsTimeZoneDifferent)
            {
                return(minutesPastMidnight);
            }
            ExDateTime exDateTime = WorkingHours.GetDateTimeFromMinutes(minutesPastMidnight, day.Date);

            exDateTime = new ExDateTime(this.timeZone, (DateTime)exDateTime);
            exDateTime = UserContextManager.GetUserContext().TimeZone.ConvertDateTime(exDateTime);
            return(WorkingHours.GetMinutesFromDateTime(exDateTime, day.Date));
        }
コード例 #3
0
        public static void DeleteCalendarItem(StoreObjectId calendarItemId, DeleteItemFlags deleteFlag)
        {
            if (calendarItemId == null)
            {
                throw new ArgumentNullException("calendarItemId");
            }
            UserContext userContext = UserContextManager.GetUserContext();

            using (CalendarItemBase calendarItemBase = (CalendarItemBase)Item.Bind(userContext.MailboxSession, calendarItemId, ItemBindOption.LoadRequiredPropertiesOnly))
            {
                calendarItemBase.DeleteMeeting(deleteFlag);
            }
        }
コード例 #4
0
        private static void ProcessCalendarItemAfterResponse(ResponseType responseType, CalendarItemBase calendarItemBase, bool intendToSendResponse)
        {
            UserContext userContext = UserContextManager.GetUserContext();

            if (responseType != ResponseType.Decline)
            {
                if (Utilities.IsItemInDefaultFolder(calendarItemBase, DefaultFolderType.DeletedItems))
                {
                    StoreObjectId[] ids = new StoreObjectId[]
                    {
                        calendarItemBase.Id.ObjectId
                    };
                    userContext.MailboxSession.Move(userContext.CalendarFolderId, ids);
                }
                if (Globals.ArePerfCountersEnabled)
                {
                    OwaSingleCounters.ItemsUpdated.Increment();
                    return;
                }
            }
            else
            {
                try
                {
                    DeleteItemFlags deleteItemFlags = intendToSendResponse ? DeleteItemFlags.DeclineCalendarItemWithResponse : DeleteItemFlags.DeclineCalendarItemWithoutResponse;
                    if (Utilities.IsItemInDefaultFolder(calendarItemBase, DefaultFolderType.DeletedItems))
                    {
                        deleteItemFlags |= DeleteItemFlags.SoftDelete;
                    }
                    else
                    {
                        deleteItemFlags |= DeleteItemFlags.MoveToDeletedItems;
                    }
                    Utilities.Delete(userContext, deleteItemFlags, new OwaStoreObjectId[]
                    {
                        OwaStoreObjectId.CreateFromStoreObject(calendarItemBase)
                    });
                }
                catch (StoragePermanentException ex)
                {
                    ExTraceGlobals.CalendarTracer.TraceDebug <string>(0L, "Exception on delete calendar item: {0}'", ex.Message);
                    throw;
                }
            }
        }
コード例 #5
0
        internal static void DeleteMeetingRequestAfterResponse(MeetingRequest meetingRequest)
        {
            UserContext userContext = UserContextManager.GetUserContext();

            meetingRequest.Load();
            try
            {
                if (userContext.IsInMyMailbox(meetingRequest) && !Utilities.IsItemInDefaultFolder(meetingRequest, DefaultFolderType.DeletedItems))
                {
                    Utilities.Delete(userContext, DeleteItemFlags.MoveToDeletedItems, new OwaStoreObjectId[]
                    {
                        OwaStoreObjectId.CreateFromStoreObject(meetingRequest)
                    });
                }
            }
            catch (StoragePermanentException ex)
            {
                ExTraceGlobals.CalendarTracer.TraceDebug <string>(0L, "Provider exception on delete of meeting request.  {0}'", ex.Message);
                throw;
            }
        }
コード例 #6
0
        public static void DeleteMeetingMessageCalendarItem(StoreObjectId meetingMessageId)
        {
            if (meetingMessageId == null)
            {
                throw new ArgumentNullException("meetingRequestId");
            }
            MeetingMessage   meetingMessage   = null;
            CalendarItemBase calendarItemBase = null;
            UserContext      userContext      = UserContextManager.GetUserContext();

            try
            {
                try
                {
                    meetingMessage = (MeetingMessage)Item.Bind(userContext.MailboxSession, meetingMessageId, ItemBindOption.LoadRequiredPropertiesOnly);
                }
                catch (ObjectNotFoundException)
                {
                    ExTraceGlobals.CalendarDataTracer.TraceDebug(0L, "Meeting request could not be found.");
                    throw;
                }
                calendarItemBase = MeetingUtilities.TryGetCorrelatedItem(meetingMessage);
                if (calendarItemBase != null)
                {
                    if (!calendarItemBase.IsOrganizer())
                    {
                        MeetingRequest meetingRequest = meetingMessage as MeetingRequest;
                        if (meetingRequest != null)
                        {
                            if (meetingRequest.MeetingRequestType == MeetingMessageType.InformationalUpdate || meetingRequest.MeetingRequestType == MeetingMessageType.Outdated || calendarItemBase.ResponseType == ResponseType.Accept || calendarItemBase.ResponseType == ResponseType.Tentative)
                            {
                                return;
                            }
                        }
                        else
                        {
                            if (!(meetingMessage is MeetingCancellation))
                            {
                                throw new OwaInvalidRequestException("Meeting message must be either a meeting invite or meeting cancellation");
                            }
                            if (meetingMessage.IsOutOfDate(calendarItemBase))
                            {
                                return;
                            }
                        }
                        calendarItemBase.DeleteMeeting(DeleteItemFlags.MoveToDeletedItems);
                    }
                }
            }
            finally
            {
                if (meetingMessage != null)
                {
                    meetingMessage.Dispose();
                    meetingMessage = null;
                }
                if (calendarItemBase != null)
                {
                    calendarItemBase.Dispose();
                    calendarItemBase = null;
                }
            }
        }
コード例 #7
0
        public static void RemoveInvalidRecipientsFromSmsMessage(MessageItem message)
        {
            Dictionary <RecipientItemType, List <string> > dictionary = null;
            int i = message.Recipients.Count - 1;

            while (i >= 0)
            {
                Participant participant  = message.Recipients[i].Participant;
                string      routingType  = participant.RoutingType;
                string      emailAddress = participant.EmailAddress;
                if (string.Equals(routingType, "SMTP", StringComparison.OrdinalIgnoreCase) && ImceaAddress.IsImceaAddress(emailAddress))
                {
                    Utilities.TryDecodeImceaAddress(participant.EmailAddress, ref routingType, ref emailAddress);
                }
                if (Utilities.IsMobileRoutingType(routingType))
                {
                    if (string.IsNullOrEmpty(Utilities.NormalizePhoneNumber(emailAddress)))
                    {
                        goto IL_D3;
                    }
                }
                else
                {
                    if (string.Equals(routingType, "EX", StringComparison.OrdinalIgnoreCase))
                    {
                        if (dictionary == null)
                        {
                            dictionary = new Dictionary <RecipientItemType, List <string> >(3);
                        }
                        RecipientItemType recipientItemType = message.Recipients[i].RecipientItemType;
                        if (!dictionary.ContainsKey(recipientItemType))
                        {
                            dictionary[recipientItemType] = new List <string>(message.Recipients.Count - 1);
                        }
                        dictionary[recipientItemType].Add(emailAddress);
                        goto IL_D3;
                    }
                    goto IL_D3;
                }
IL_DF:
                i--;
                continue;
IL_D3:
                message.Recipients.RemoveAt(i);
                goto IL_DF;
            }
            if (dictionary == null || dictionary.Count == 0)
            {
                return;
            }
            IRecipientSession recipientSession = Utilities.CreateADRecipientSession(ConsistencyMode.IgnoreInvalid, UserContextManager.GetUserContext());

            foreach (KeyValuePair <RecipientItemType, List <string> > keyValuePair in dictionary)
            {
                Result <ADRawEntry>[] array = recipientSession.FindByLegacyExchangeDNs(keyValuePair.Value.ToArray(), new PropertyDefinition[]
                {
                    ADRecipientSchema.DisplayName,
                    ADOrgPersonSchema.MobilePhone
                });
                if (array != null && array.Length != 0)
                {
                    foreach (Result <ADRawEntry> result in array)
                    {
                        if (result.Data != null)
                        {
                            string text  = result.Data[ADRecipientSchema.DisplayName] as string;
                            string text2 = Utilities.NormalizePhoneNumber(result.Data[ADOrgPersonSchema.MobilePhone] as string);
                            if (!string.IsNullOrEmpty(text) && !string.IsNullOrEmpty(text2))
                            {
                                message.Recipients.Add(new Participant(text, text2, "MOBILE"), keyValuePair.Key);
                            }
                        }
                    }
                }
            }
        }