How to build Attachments object?

B

Bingo

That won't work since I need to replace the Sender with
my own name and email. Thanks.
 
D

Dmitry Streblechenko \(MVP\)

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
 
B

Bingo

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.
 
D

Dmitry Streblechenko \(MVP\)

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
 
B

Bingo

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
 
D

Dmitry Streblechenko \(MVP\)

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top