Пример #1
0
        public ContactDescriptor(IEMessage message, string entryID, string searchEntryID, OutlookAddressBook addressBook)
        {
            _searchEntryID = searchEntryID;
            _entryID       = entryID;
            _addressBook   = addressBook;
            SetFullName(message);

            _emailAddresses = GetEmailAddresses();

            if (_emailAddresses == null || _emailAddresses.Count == 0)
            {
                string tempString = message.GetStringProp(MAPIConst.PR_EMAIL_ADDRESS);
                if (tempString != null)
                {
                    _contactNames.EmailAddress = tempString;
                }
                else
                {
                    int tag = message.GetIDsFromNames(ref GUID.set3, lID.contactEmail, PropType.PT_STRING8);
                    tempString = message.GetStringProp(tag);
                    if (tempString != null)
                    {
                        _contactNames.EmailAddress = tempString;
                    }
                }
            }
            else
            {
                _contactNames.EmailAddress = _emailAddresses[0] as string;
            }

            _birthday = message.GetDateTimeProp(MAPIConst.PR_BIRTHDAY);
            foreach (Phone phone in Phone.GetPhones())
            {
                _phones.Add(new Pair(phone, message.GetStringProp(phone.MAPIPhoneAsInt)));
            }
            LoadProp(ref _companyName, message, MAPIConst.PR_COMPANY_NAME);
            LoadProp(ref _jobTitle, message, MAPIConst.PR_TITLE);
            LoadProp(ref _streetAddress, message, MAPIConst.PR_POSTAL_ADDRESS);
            LoadProp(ref _businessHomePage, message, MAPIConst.PR_BUSINESS_HOME_PAGE);

            string suffix = string.Empty;

            LoadProp(ref suffix, message, MAPIConst.PR_GENERATION);
            _contactNames.Suffix = suffix;
            string middleName = string.Empty;

            LoadProp(ref middleName, message, MAPIConst.PR_MIDDLE_NAME);
            _contactNames.MiddleName = middleName;
            string namePrefix = string.Empty;

            LoadProp(ref namePrefix, message, MAPIConst.PR_DISPLAY_NAME_PREFIX);
            _contactNames.NamePrefix = namePrefix;
            LoadStreamProp(ref _description, message);
            _outlookCategories = OutlookSession.GetCategories(message);
        }
Пример #2
0
        static public bool ProcessCategories(IEMAPIProp message, ArrayList categories)
        {
            ArrayList storedCategories = OutlookSession.GetCategories(message);

            if (categories.Count > 0)
            {
                return(UpdateCategories(categories, storedCategories, message));
            }
            else
            {
                return(RemoveCategories(storedCategories, message));
            }
        }
Пример #3
0
        private TaskDescriptor(FolderDescriptor folder, IEMessage message, string entryID)
        {
            _folder  = folder;
            _entryID = entryID;
            if (message != null)
            {
                _subject     = Task.GetSubject(message);
                _description = Task.GetDescription(message);
                _priority    = Task.GetPriority(message);
                _dueDate     = Task.GetDueDate(message);
                _dueDate     = _dueDate.ToUniversalTime();
                _startDate   = Task.GetStartDate(message);
                _startDate   = _startDate.ToUniversalTime();
                _remindDate  = Task.GetRemindDate(message);

                _OMTaskId          = Task.GetOMTaskID(message);
                _reminderActive    = Task.GetReminderActive(message);
                _status            = Task.GetStatus(message, false);
                _outlookCategories = OutlookSession.GetCategories(message);
            }
        }
Пример #4
0
        protected void Init(FolderDescriptor folderDescriptor, string entryID, IEMessage message, string longBody)
        {
            _longBody     = longBody;
            _folder       = folderDescriptor;
            _messageClass = MessageType.GetMessageClass(message);
            if (!Settings.ProcessAllPropertiesForMessage)
            {
                _subject = "test";
                return;
            }
            string folderID = message.GetBinProp(MAPIConst.PR_PARENT_ENTRYID);

            if (folderID != null)
            {
                string   storeID = message.GetBinProp(MAPIConst.PR_STORE_ENTRYID);
                IEFolder folder  = OutlookSession.OpenFolder(folderID, storeID);
                if (folder != null)
                {
                    using ( folder )
                    {
                        _folder = FolderDescriptor.Get(folder);
                    }
                }
            }
            _entryID = entryID;

            if (_folder != null && Folder.IsIgnored(_folder))
            {
                _toDeleteResource = true;
                return;
            }

            int tag = message.GetIDsFromNames(ref GUID.set1, lID.msgDeletedInIMAP, PropType.PT_LONG);

            _deletedInIMAP = message.GetLongProp(tag) == 1;

            if (_deletedInIMAP && Settings.IgnoreDeletedIMAPMessages)
            {
                _toDeleteResource = true;
                return;
            }

            _subject = message.GetStringProp(MAPIConst.PR_SUBJECT);
            if (_subject == null)
            {
                _subject = string.Empty;
            }
            _unread = message.IsUnread();

            _lastModifiedDate = message.GetDateTimeProp(MAPIConst.PR_LAST_MODIFICATION_TIME);
            _lastModifiedDate = _lastModifiedDate.ToUniversalTime();

            _messageSize = message.GetLongProp(MAPIConst.PR_MESSAGE_SIZE);
            _iconIndex   = message.GetLongProp(MAPIConst.PR_ICON_INDEX);

            _priority = message.GetLongProp(MAPIConst.PR_PRIORITY);
            int importance = message.GetLongProp(MAPIConst.PR_IMPORTANCE, true);

            if (importance == -9999)
            {
                importance = 1;
            }
            _importance = importance - 1;
            _flagStatus = message.GetLongProp(MAPIConst.PR_FLAG_STATUS);

            if (_flagStatus == 2)
            {
                _flagColor = message.GetLongProp(MAPIConst.PR_FLAG_COLOR, true);
                if (_flagColor == -9999)
                {
                    _flagColor = 6;
                }
            }

            _internetMessageID = message.GetStringProp(MAPIConst.PR_INTERNET_MESSAGE_ID);

            _recordKey         = message.GetBinProp(MAPIConst.PR_RECORD_KEY);
            _conversationIndex = message.GetBinProp(MAPIConst.PR_CONVERSATION_INDEX);

            _replyToID          = message.GetStringProp(MAPIConst.PR_IN_REPLY_TO_ID);
            _internetReferences = message.GetStringProp(MAPIConst.PR_INTERNET_REFERENCES);

            if (Settings.CreateAnnotationFromFollowup)
            {
                int annotationTag = message.GetIDsFromNames(ref GUID.set1, lID.msgFlagAnnotation, PropType.PT_STRING8);
                _flag = message.GetStringProp(annotationTag);
            }

            _outlookCategories = OutlookSession.GetCategories(message);;

            _receivedTime = message.GetDateTimeProp(MAPIConst.PR_MESSAGE_DELIVERY_TIME);
            _sentOn       = message.GetDateTimeProp(MAPIConst.PR_CLIENT_SUBMIT_TIME);
            if (_receivedTime == DateTime.MinValue)
            {
                _receivedTime = _sentOn;
            }

            _listUnsubscribe = message.GetStringProp(MAPIConst.PR_LIST_UNSUBSCRIBE);
            if (_listUnsubscribe != null)
            {
                _listUnsubscribe = ExtractUnsubscribeEmail(_listUnsubscribe);
            }

            _contactCreated = MailSenderHelper.LoadSenderInfo(message, out _senderName, out _senderEmail);

            if (Settings.ProcessRecipients)
            {
                _state.EndOfInit(this, message);
            }
        }