Beispiel #1
0
 internal OutlookStorage(OutlookStorage parent, CFStorage storage)
     : this(parent._file, storage)
 {
 }
Beispiel #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="OutlookRecipient"/> class.
 /// </summary>
 /// <param name="message">The message.</param>
 public OutlookRecipient(OutlookStorage parent, CFStorage storage)
     : base(parent, storage)
 {
     this._propHeaderSize = MapiTags.PropertiesStreamHeaderAttachOrRecip;
 }
Beispiel #3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="OutlookAttachment"/> class.
        /// </summary>
        /// <param name="message">The message.</param>
        internal OutlookAttachment(OutlookStorage parent, CFStorage message)
            : base(parent, message)
        {
            GC.SuppressFinalize(message);
            _propHeaderSize = MapiTags.PropertiesStreamHeaderAttachOrRecip;

            CreationTime         = GetMapiPropertyDateTime(MapiTags.PR_CREATION_TIME);
            LastModificationTime = GetMapiPropertyDateTime(MapiTags.PR_LAST_MODIFICATION_TIME);

            ContentId = GetMapiPropertyString(MapiTags.PR_ATTACH_CONTENTID);
            IsInline  = ContentId != null;

            var isContactPhoto = GetMapiPropertyBool(MapiTags.PR_ATTACHMENT_CONTACTPHOTO);

            if (isContactPhoto == null)
            {
                IsContactPhoto = false;
            }
            else
            {
                IsContactPhoto = (bool)isContactPhoto;
            }

            var renderingPosition = GetMapiPropertyInt32(MapiTags.PR_RENDERING_POSITION);

            if (renderingPosition == null)
            {
                RenderingPosition = -1;
            }
            else
            {
                RenderingPosition = (int)renderingPosition;
            }

            var fileName = GetMapiPropertyString(MapiTags.PR_ATTACH_LONG_FILENAME);

            if (string.IsNullOrEmpty(fileName))
            {
                fileName = GetMapiPropertyString(MapiTags.PR_ATTACH_FILENAME);
            }

            if (string.IsNullOrEmpty(fileName))
            {
                fileName = GetMapiPropertyString(MapiTags.PR_DISPLAY_NAME);
            }

            FileName = fileName != null
          ? FileManager.RemoveInvalidFileNameChars(fileName)
          : "Nameless";

            MimeTag = this.GetMapiPropertyString(MapiTags.PR_ATTACH_MIME_TAG);

            var attachmentMethod = GetMapiPropertyInt32(MapiTags.PR_ATTACH_METHOD);

            switch (attachmentMethod)
            {
            case MapiTags.ATTACH_BY_REFERENCE:
            case MapiTags.ATTACH_BY_REF_RESOLVE:
            case MapiTags.ATTACH_BY_REF_ONLY:
                ResolveAttachment();
                break;

            case MapiTags.ATTACH_OLE:
                var storage = GetMapiProperty(MapiTags.PR_ATTACH_DATA_BIN) as CFStorage;
                //var attachmentOle = new OutlookAttachment(this, );
                _data = storage.GetStream("CONTENTS").GetData();
                var fileTypeInfo = FileTypeSelector.GetFileTypeFileInfo(Data);

                if (string.IsNullOrEmpty(FileName))
                {
                    FileName = fileTypeInfo.Description;
                }

                FileName += "." + fileTypeInfo.Extension.ToLower();
                IsInline  = true;
                break;
            }
        }
Beispiel #4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Storage.Task" /> class.
        /// </summary>
        /// <param name="message"> The message. </param>
        internal OutlookAppointment(OutlookStorage parent, CFStorage message)
            : base(parent, message)
        {
            //GC.SuppressFinalize(message);
            _propHeaderSize = MapiTags.PropertiesStreamHeaderTop;

            Location             = GetMapiPropertyString(MapiTags.Location);
            Start                = GetMapiPropertyDateTime(MapiTags.AppointmentStartWhole);
            End                  = GetMapiPropertyDateTime(MapiTags.AppointmentEndWhole);
            AllAttendees         = GetMapiPropertyString(MapiTags.AppointmentAllAttendees);
            ToAttendees          = GetMapiPropertyString(MapiTags.AppointmentToAttendees);
            CcAttendees          = GetMapiPropertyString(MapiTags.AppointmentCCAttendees);
            NotAllowPropose      = GetMapiPropertyBool(MapiTags.AppointmentNotAllowPropose);
            UnsendableRecipients = GetUnsendableRecipients(MapiTags.AppointmentUnsendableRecipients);

            #region Recurrence
            var recurrenceType = GetMapiPropertyInt32(MapiTags.ReccurrenceType);
            if (recurrenceType == null)
            {
                ReccurrenceType = AppointmentRecurrenceType.None;
            }
            else
            {
                switch (recurrenceType)
                {
                case 1:
                    ReccurrenceType = AppointmentRecurrenceType.Daily;
                    break;

                case 2:
                    ReccurrenceType = AppointmentRecurrenceType.Weekly;
                    break;

                case 3:
                case 4:
                    ReccurrenceType = AppointmentRecurrenceType.Montly;
                    break;

                case 5:
                case 6:
                    ReccurrenceType = AppointmentRecurrenceType.Yearly;
                    break;

                default:
                    ReccurrenceType = AppointmentRecurrenceType.None;
                    break;
                }
            }

            RecurrencePatern = GetMapiPropertyString(MapiTags.ReccurrencePattern);
            #endregion

            #region ClientIntent
            var clientIntentList = new List <AppointmentClientIntent>();
            var clientIntent     = GetMapiPropertyInt32(MapiTags.PidLidClientIntent);

            if (clientIntent == null)
            {
                ClientIntent = null;
            }
            else
            {
                var bitwiseValue = (int)clientIntent;

                if ((bitwiseValue & 1) == 1)
                {
                    clientIntentList.Add(AppointmentClientIntent.Manager);
                }

                if ((bitwiseValue & 2) == 2)
                {
                    clientIntentList.Add(AppointmentClientIntent.Delegate);
                }

                if ((bitwiseValue & 4) == 4)
                {
                    clientIntentList.Add(AppointmentClientIntent.DeletedWithNoResponse);
                }

                if ((bitwiseValue & 8) == 8)
                {
                    clientIntentList.Add(AppointmentClientIntent.DeletedExceptionWithNoResponse);
                }

                if ((bitwiseValue & 16) == 16)
                {
                    clientIntentList.Add(AppointmentClientIntent.RespondedTentative);
                }

                if ((bitwiseValue & 32) == 32)
                {
                    clientIntentList.Add(AppointmentClientIntent.RespondedAccept);
                }

                if ((bitwiseValue & 64) == 64)
                {
                    clientIntentList.Add(AppointmentClientIntent.RespondedDecline);
                }
                if ((bitwiseValue & 128) == 128)
                {
                    clientIntentList.Add(AppointmentClientIntent.ModifiedStartTime);
                }

                if ((bitwiseValue & 256) == 256)
                {
                    clientIntentList.Add(AppointmentClientIntent.ModifiedEndTime);
                }

                if ((bitwiseValue & 512) == 512)
                {
                    clientIntentList.Add(AppointmentClientIntent.ModifiedLocation);
                }

                if ((bitwiseValue & 1024) == 1024)
                {
                    clientIntentList.Add(AppointmentClientIntent.RespondedExceptionDecline);
                }

                if ((bitwiseValue & 2048) == 2048)
                {
                    clientIntentList.Add(AppointmentClientIntent.Canceled);
                }

                if ((bitwiseValue & 4096) == 4096)
                {
                    clientIntentList.Add(AppointmentClientIntent.ExceptionCanceled);
                }

                ClientIntent = clientIntentList.AsReadOnly();
            }
            #endregion
        }
Beispiel #5
0
 public OutlookNameProp(OutlookStorage parent, CFStorage storage)
     : base(parent, storage)
 {
 }
Beispiel #6
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Storage.Contact" /> class.
        /// </summary>
        /// <param name="message"> The message. </param>
        internal OutlookContact(OutlookStorage parent, CFStorage message)
            : base(parent, message)
        {
            GC.SuppressFinalize(message);
            _propHeaderSize = MapiTags.PropertiesStreamHeaderTop;

            DisplayName = GetMapiPropertyString(MapiTags.PR_DISPLAY_NAME);
            Prefix      = GetMapiPropertyString(MapiTags.PR_DISPLAY_NAME_PREFIX);
            Initials    = GetMapiPropertyString(MapiTags.PR_INITIALS);
            SurName     = GetMapiPropertyString(MapiTags.PR_SURNAME);
            GivenName   = GetMapiPropertyString(MapiTags.PR_GIVEN_NAME);
            Generation  = GetMapiPropertyString(MapiTags.PR_GENERATION);
            Function    = GetMapiPropertyString(MapiTags.PR_TITLE);
            Department  = GetMapiPropertyString(MapiTags.PR_DEPARTMENT_NAME);
            Company     = GetMapiPropertyString(MapiTags.PR_COMPANY_NAME);

            #region Business address information
            WorkAddress               = GetMapiPropertyString(MapiTags.WorkAddress);
            BusinessAddressStreet     = GetMapiPropertyString(MapiTags.PR_BUSINESS_ADDRESS_STREET);
            BusinessAddressCity       = GetMapiPropertyString(MapiTags.PR_BUSINESS_ADDRESS_CITY);
            BusinessAddressState      = GetMapiPropertyString(MapiTags.PR_BUSINESS_ADDRESS_STATE_OR_PROVINCE);
            BusinessAddressPostalCode = GetMapiPropertyString(MapiTags.PR_BUSINESS_ADDRESS_POSTAL_CODE);
            BusinessAddressCountry    = GetMapiPropertyString(MapiTags.PR_BUSINESS_ADDRESS_COUNTRY);
            BusinessTelephoneNumber   = GetMapiPropertyString(MapiTags.PR_BUSINESS_TELEPHONE_NUMBER);
            BusinessTelephoneNumber2  = GetMapiPropertyString(MapiTags.PR_BUSINESS2_TELEPHONE_NUMBER);
            BusinessFaxNumber         = GetMapiPropertyString(MapiTags.PR_BUSINESS_FAX_NUMBER);
            BusinessHomePage          = GetMapiPropertyString(MapiTags.PR_BUSINESS_HOME_PAGE);

            // WorkAddress is only filled when the msg object is made with Outlook 2007 or higher.
            // So we fill it from code.
            if (string.IsNullOrEmpty(WorkAddress))
            {
                var workAddress = string.Empty;

                if (!string.IsNullOrEmpty(BusinessAddressStreet))
                {
                    workAddress += BusinessAddressStreet + Environment.NewLine;
                }

                if (!string.IsNullOrEmpty(BusinessAddressPostalCode))
                {
                    workAddress += BusinessAddressPostalCode + Environment.NewLine;
                }

                if (!string.IsNullOrEmpty(BusinessAddressCity))
                {
                    workAddress += BusinessAddressCity + Environment.NewLine;
                }

                if (!string.IsNullOrEmpty(BusinessAddressCountry))
                {
                    workAddress += BusinessAddressCountry + Environment.NewLine;
                }

                if (!string.IsNullOrEmpty(workAddress))
                {
                    WorkAddress = workAddress;
                }
            }
            #endregion

            #region Home address information
            HomeAddress           = GetMapiPropertyString(MapiTags.HomeAddress);
            HomeAddressStreet     = GetMapiPropertyString(MapiTags.PR_HOME_ADDRESS_STREET);
            HomeAddressCity       = GetMapiPropertyString(MapiTags.PR_HOME_ADDRESS_CITY);
            HomeAddressState      = GetMapiPropertyString(MapiTags.PR_HOME_ADDRESS_STATE_OR_PROVINCE);
            HomeAddressPostalCode = GetMapiPropertyString(MapiTags.PR_HOME_ADDRESS_POSTAL_CODE);
            HomeAddressCountry    = GetMapiPropertyString(MapiTags.PR_HOME_ADDRESS_COUNTRY);
            HomeTelephoneNumber   = GetMapiPropertyString(MapiTags.PR_HOME_TELEPHONE_NUMBER);
            HomeTelephoneNumber2  = GetMapiPropertyString(MapiTags.PR_HOME2_TELEPHONE_NUMBER);
            HomeFaxNumber         = GetMapiPropertyString(MapiTags.PR_HOME_FAX_NUMBER);

            // HomeAddress is only filled when the msg object is made with Outlook 2007 or higher.
            // So we fill it from code.
            if (string.IsNullOrEmpty(HomeAddress))
            {
                var homeAddress = string.Empty;

                if (!string.IsNullOrEmpty(HomeAddressStreet))
                {
                    homeAddress += HomeAddressStreet + Environment.NewLine;
                }

                if (!string.IsNullOrEmpty(HomeAddressPostalCode))
                {
                    homeAddress += HomeAddressPostalCode + Environment.NewLine;
                }

                if (!string.IsNullOrEmpty(HomeAddressCity))
                {
                    homeAddress += HomeAddressCity + Environment.NewLine;
                }

                if (!string.IsNullOrEmpty(HomeAddressCountry))
                {
                    homeAddress += HomeAddressCountry + Environment.NewLine;
                }

                if (!string.IsNullOrEmpty(homeAddress))
                {
                    HomeAddress = homeAddress;
                }
            }
            #endregion

            #region Other address information
            OtherAddress           = GetMapiPropertyString(MapiTags.OtherAddress);
            OtherAddressStreet     = GetMapiPropertyString(MapiTags.PR_OTHER_ADDRESS_STREET);
            OtherAddressCity       = GetMapiPropertyString(MapiTags.PR_OTHER_ADDRESS_CITY);
            OtherAddressState      = GetMapiPropertyString(MapiTags.PR_OTHER_ADDRESS_STATE_OR_PROVINCE);
            OtherAddressPostalCode = GetMapiPropertyString(MapiTags.PR_OTHER_ADDRESS_POSTAL_CODE);
            OtherAddressCountry    = GetMapiPropertyString(MapiTags.PR_OTHER_ADDRESS_COUNTRY);
            OtherTelephoneNumber   = GetMapiPropertyString(MapiTags.PR_OTHER_TELEPHONE_NUMBER);

            // OtherAddress is only filled when the msg object is made with Outlook 2007 or higher.
            // So we fill it from code.
            if (string.IsNullOrEmpty(OtherAddress))
            {
                var otherAddress = string.Empty;

                if (!string.IsNullOrEmpty(OtherAddressStreet))
                {
                    otherAddress += OtherAddressStreet + Environment.NewLine;
                }

                if (!string.IsNullOrEmpty(OtherAddressPostalCode))
                {
                    otherAddress += OtherAddressPostalCode + Environment.NewLine;
                }

                if (!string.IsNullOrEmpty(OtherAddressCity))
                {
                    otherAddress += OtherAddressCity + Environment.NewLine;
                }

                if (!string.IsNullOrEmpty(OtherAddressCountry))
                {
                    otherAddress += OtherAddressCountry + Environment.NewLine;
                }

                if (!string.IsNullOrEmpty(otherAddress))
                {
                    OtherAddress = otherAddress;
                }
            }
            #endregion

            #region Primary information
            PrimaryTelephoneNumber = GetMapiPropertyString(MapiTags.PR_PRIMARY_TELEPHONE_NUMBER);
            PrimaryFaxNumber       = GetMapiPropertyString(MapiTags.PR_PRIMARY_FAX_NUMBER);
            #endregion

            #region Assistant information
            AssistantName            = GetMapiPropertyString(MapiTags.PR_ASSISTANT);
            AssistantTelephoneNumber = GetMapiPropertyString(MapiTags.PR_ASSISTANT_TELEPHONE_NUMBER);
            #endregion

            InstantMessagingAddress = GetMapiPropertyString(MapiTags.InstantMessagingAddress);

            #region Telephone numbers
            CompanyMainTelephoneNumber = GetMapiPropertyString(MapiTags.PR_COMPANY_MAIN_PHONE_NUMBER);
            CellularTelephoneNumber    = GetMapiPropertyString(MapiTags.PR_CELLULAR_TELEPHONE_NUMBER);
            CarTelephoneNumber         = GetMapiPropertyString(MapiTags.PR_CAR_TELEPHONE_NUMBER);
            RadioTelephoneNumber       = GetMapiPropertyString(MapiTags.PR_RADIO_TELEPHONE_NUMBER);
            BeeperTelephoneNumber      = GetMapiPropertyString(MapiTags.PR_BEEPER_TELEPHONE_NUMBER);
            CallbackTelephoneNumber    = GetMapiPropertyString(MapiTags.PR_CALLBACK_TELEPHONE_NUMBER);
            TextTelephone = GetMapiPropertyString(MapiTags.PR_TELEX_NUMBER);
            ISDNNumber    = GetMapiPropertyString(MapiTags.PR_ISDN_NUMBER);
            TelexNumber   = GetMapiPropertyString(MapiTags.PR_TELEX_NUMBER);
            #endregion

            #region E-mail information
            Email1EmailAddress = GetMapiPropertyString(MapiTags.Email1EmailAddress);
            Email1DisplayName  = GetMapiPropertyString(MapiTags.Email1DisplayName);
            Email2EmailAddress = GetMapiPropertyString(MapiTags.Email2EmailAddress);
            Email2DisplayName  = GetMapiPropertyString(MapiTags.Email2DisplayName);
            Email3EmailAddress = GetMapiPropertyString(MapiTags.Email3EmailAddress);
            Email3DisplayName  = GetMapiPropertyString(MapiTags.Email3DisplayName);
            #endregion

            var birthday = GetMapiPropertyDateTime(MapiTags.PR_BIRTHDAY);
            if (birthday != null)
            {
                Birthday = ((DateTime)birthday).ToLocalTime();
            }

            var weddingAnniversary = GetMapiPropertyDateTime(MapiTags.PR_WEDDING_ANNIVERSARY);
            if (weddingAnniversary != null)
            {
                WeddingAnniversary = ((DateTime)weddingAnniversary).ToLocalTime();
            }

            SpouseName = GetMapiPropertyString(MapiTags.PR_SPOUSE_NAME);
            Profession = GetMapiPropertyString(MapiTags.PR_PROFESSION);
            Html       = GetMapiPropertyString(MapiTags.Html);
        }