Example #1
0
        public void PopulateProperties(EMessageProperties properties)
        {
            List<cemapi.PropTags> tags = new List<cemapi.PropTags>();
            if ((properties & EMessageProperties.Subject) != 0)
                tags.Add(cemapi.PropTags.PR_SUBJECT);
            if ((properties & EMessageProperties.DeliveryTime) != 0)
                tags.Add(cemapi.PropTags.PR_MESSAGE_DELIVERY_TIME);
            if ((properties & EMessageProperties.Status) != 0)
                tags.Add(cemapi.PropTags.PR_MSG_STATUS);
            if ((properties & EMessageProperties.Body) != 0)
                tags.Add(cemapi.PropTags.PR_BODY);
            if ((properties & EMessageProperties.Sender) != 0)
                tags.AddRange(new cemapi.PropTags[] { cemapi.PropTags.PR_SENDER_EMAIL_ADDRESS, cemapi.PropTags.PR_SENDER_NAME });
            if ((properties & EMessageProperties.Flags) != 0)
                tags.Add(cemapi.PropTags.PR_MESSAGE_FLAGS);

            cemapi.IPropValue[] props = this.msg.GetProps(tags.ToArray());

            int len = props.Length;
            for (int i = 0; i < props.Length; i++)
            {
                switch (tags[i])
                {
                    case cemapi.PropTags.PR_SUBJECT:
                        this.subject = props[i].AsString;
                        break;
                    case cemapi.PropTags.PR_MESSAGE_DELIVERY_TIME:
                        if (props[i].Type != null)
                            this.deliveryTime = props[i].AsUInt64;
                        else
                            this.deliveryTime = 0xFFFFFFFFFFFFFFFF;
                        break;
                    case cemapi.PropTags.PR_MSG_STATUS:
                        this.status = (EMessageStatus)props[i].AsInt32;
                        this.statusDone = true;
                        break;
                    case cemapi.PropTags.PR_BODY:
                        this.body = props[i].AsString;
                        break;
                    case cemapi.PropTags.PR_SENDER_EMAIL_ADDRESS: // sender
                        if (props[i].Tag != cemapi.PropTags.PR_ERROR)
                        {
                            this.sender = new MAPIContact(props[i].AsString, props[i + 1].AsString, this.msgId.ParentFolder.Parent);
                            this.senderDone = true;
                        }
                        else
                        {
                            this.sender = null;
                            this.senderDone = false;
                        }
                        i++;
                        break;
                    case cemapi.PropTags.PR_MESSAGE_FLAGS:
                        this.flagsDone = true;
                        this.flags = (EMessageFlags)props[i].AsInt32;
                        break;
                }
            }
        }
Example #2
0
 public void InvalidateProperties(EMessageProperties properties)
 {
     if ((properties & EMessageProperties.Body) != 0)
         this.body = null;
     if ((properties & EMessageProperties.Subject) != 0)
         this.subject = null;
     if ((properties & EMessageProperties.DeliveryTime) != 0)
         this.deliveryTime = 0;
     if ((properties & EMessageProperties.Status) != 0)
         this.statusDone = false;
     if ((properties & EMessageProperties.Sender) != 0)
         this.senderDone = false;
     if ((properties & EMessageProperties.Flags) != 0)
         this.flagsDone = false;
 }