Reputation: 5
I have a pdf document emailed to me multiple times a day in. The file, file name, and subject lines change but the formats come the same way every time.
However the subject line and file name codes are not useful for organizing mail, so I want the subject line to change to some or all of the contents of the pdf file.
So far I have a script to change the subject line of the incoming emails but it is static. Obviously it won't change dynamically much less change to the contents of the attachment.
Sub RunAScriptRuleRoutine(MyMail As MailItem)
Dim strID As String
Dim olNS As Outlook.NameSpace
Dim olMail As Outlook.MailItem
strID = MyMail.EntryID
Set olNS = Application.GetNamespace("MAPI")
Set olMail = olNS.GetItemFromID(strID)
' do stuff with olMail, e.g.
olMail.Subject = "new subject line"
olMail.Save
Set olMail = Nothing
Set olNS = Nothing
End Sub
The result I'm looking for is for incoming email's subject line to change to the contents of the pdf file attached to it.
Upvotes: 0
Views: 129
Reputation: 5834
There's nothing in the Outlook Object Model specifically that will provide access to an file attachment's contents, aside from facilitating saving the attachment to disk. You will need to use additional APIs for each proprietary file content type that you want to parse.
Upvotes: 0