MailItem is an object that represents a mail message in Visual Basic for Applications (VBA). Questions about its properties, methods, corresponding events and usage in general may have this tag.
Questions tagged [mailitem]
181 questions
0
votes
1 answer
Outlook MailItem Save/SaveAs
I have an outlook add-in that allows the user to save an email into a database. When the user does save the email I modify the email subject so it can be identified as being saved.
Saving the email can happen in two ways. Via a button on the tool…

Stuv
- 63
- 1
- 1
- 6
0
votes
1 answer
Outlook Add-In, right Eventhandler
I try to build a Add-In that saves Attachments form a Mail with a specific Subject.
Till now that works fine, but i think that im using the wrong Eventhandler for my needs.
It should start if a new Mail comes in, and then check the whole Inbox + the…

RobertZ
- 3
- 1
0
votes
2 answers
Getting From, SentOnBehalfOfName and Account name from MailItem Object (Outlook Shared Addins)
I am using Vs2010 -> Extensibility->Shared Add-in
I have added a event handler to my ItemSend
applicationObject.ItemSend += new Outlook.ApplicationEvents_11_ItemSendEventHandler(applicationObject_ItemSend);
void…

C J
- 429
- 1
- 10
- 34
0
votes
1 answer
Setting outlook.attachment = Mail item attachment
I am trying to write a script that saves attachments to a directory. When I run it, I get an error message "type mismatch" and the line Set olAtt = olMi.Attachments is highlighted. Could someone advise?
Sub SaveAttachments()
Dim olApp As…

user1482821
- 1
- 1
0
votes
1 answer
mailitem attachment not shown on the mailitem
I got problem with programmingly create an outlook mailitem with attachment,
as following code
Outlook.MailItem mail =
outlook.Application.CreateItem
(Outlook.OlItemType.olMailItem)
as…

Jian_H
- 173
- 1
- 4
- 18
-1
votes
1 answer
Editing and forwarding email (from different sender) Outlook VBA
i'm new in VBA so i need help to understand how can i:
taking an email from my inbox, edit the body (deleting the last two rows and the first five rows).
Forwarding that modified mail from another mailbox to another one.

Lidia Frizzi
- 1
- 1
-1
votes
1 answer
email address not displaying correctly when importing .pst to mysql using c#
I am using the code below to export an outlook-mounted .pst file called working to a local MySQL database, for the most part the code works fine however some "Sender_Email and "Received_Email" are displaying in their EX format like the below…

MH731Z
- 61
- 11
-1
votes
1 answer
VB.NET runs differently when message box removed - Outlook Application
I'm currently developing an Outlook Application, which seemed to work perfectly during testing.
This code seems to work when the MSGBox("ASDFG") is in place (rsts.Count returns 1), but as soon as it is removed, the statement returns 0. I have tried…

Michael Davison
- 89
- 10
-1
votes
1 answer
Should I put email address or Account name in SentOnBehalfofName?
I am writing a program to allow user to send email from Exchange Shared Mailbox or "Send on behalf Of". I am planning to use MailItem.SentOnBehalfofName to do that.
Example:
Shared Mail box name - name "Test Shared mailbox"
Shared mailbox Email…

TNG
- 1
- 3
-1
votes
1 answer
Outlook Inbox Folder Parent always returns 0 Folders
I have a problem with my office vsto add-in. Whenever I try to loop through all the Email Folders to get their emails I always get 0 items and I don't really know why. Here is my code :
var inbox =…
user8620003
-1
votes
1 answer
How to save MailItem after sending
I'am creating MailItem:
Application outlook = new Application();
_mailItem = outlook.CreateItem(OIItemType.olMailItem);
Inspector inspector = _mailItem .GetInspector;
inspector.Activate();
set recipient, body,…

Uladzimir Sharyi
- 144
- 1
- 14
-1
votes
1 answer
Get concise email header Outlook Mailitem VB.Net
I am catching the outlook mailItem after its being sent. I would like to get the email header i.e. To, From, CC, Subject, Body etc. I have tried using
Const PR_TRANSPORT_MESSAGE_HEADERS =…

Neophile
- 5,660
- 14
- 61
- 107
-1
votes
1 answer
Show MsgBox upon receiving email with specified subject or sender
How do I show a MsgBox or alert upon receiving a message with a specified subject or sender?
I put this procedure in ThisOutlookSession block.
Private Sub olInboxItems_ItemAdd(ByVal Item As Object)
Dim myMail As MailItem
Dim name As…

caruzo
- 127
- 1
- 12
-1
votes
1 answer
Backgroundworker allowing UI to freeze when iterating through Outlook MailItems
I'm working on a WPF support tool that looks at a shared Outlook Mailbox, collects the Folders, creates TabItems in a TabControl to represent the folders, then collects MailItems that it finds in the Folders of the past 14 days. Each Folder…

Jake Shakesworth
- 3,335
- 4
- 29
- 43
-2
votes
1 answer
How to get MailItem content on loading a mail in Outlook
I am creating an Addin for outlook and I have a requirement to fetch the mail content and parse it by my code. Problem I am facing with is to get the mail content.
Using Property accessor("http://schemas.microsoft.com/mapi/proptag/0x007D001E"), I…

Adithya Ranganath
- 76
- 1
- 11