private void store_NewMessage(IMAPIMessageID newMessageID, EMessageFlags flags) { IMAPIMessage msg = newMessageID.OpenMessage(); string m = msg.Subject + ", from " + msg.Sender; MessageBox.Show(m, "New message: " + flags.ToString()); }
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; } } }
public NEWMAIL_NOTIFICATION(IEntryID entryID, IEntryID parentID, EMessageFlags flags) { this.entryID = entryID; this.parentID = parentID; this.flags = flags; }