How to build Attachments object?

  • Thread starter Thread starter Bingo
  • Start date Start date
Nothing prevents you from setting (or deleting) the PR_SENDER_xxx
propertiers after calling CopyTo().

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
 
I created and saved the Forward MailItem. I then created
the SafeMailItem from it.


oRdpMailNew.Item = oMapiMailNew
' Sender Email
oRdpMailNew.Fields(&H0C1F001E) = "(e-mail address removed)"
' Sender Name
oRdpMailNew.Fields(&H0C1A001E) = "Bingo"
' Since both Sender EntryID and Search Key are binary
' fields, I'm not sure what I need to do with them
' oRdpMailNew.Fields(&H0C190102)
' oRdpMailNew.Fields(&H0C1D0102)

I checked both Sender Email and Name fields and they took
the new values. Then I displayed the email.

oMapiMailNew.Display

The From field still has another person's name and email
not mine. How do I reset the PR_Sender_XX fields
correctly? Thanks.
 
Outlook does not see changes made with anything but the Outlook Object Model
until you completely dereference the message and then reopen it Add
something like the following:

strEntryID = oMapiMailNew.EntryID
set oMapiMailNew = Nothing
set oRdpMailNew = Nothing
'reopen it
set oMapiMailNew = Application.Session.GetItemFromID(strEntryID)
oMapiMailNew.Display

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
 
I tried it and it still returns another person's name and
email not mine. After I reopened the new MailItem, I
passed it to a new SafeMailItem. Then I checked both
Sender Name and Emails fields, both are reset back to
their original values. Do I need to set the Sender's
EntryID and Search Key fields? Since both are binary
fields, I do not know how to set them. Thanks. Bingo
 
You need to set these binary (or any other, including string, properties) to
Nothing or Empty to have them deleted.

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
 
Back
Top