A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Add-ins for Outlook
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Adding a header item with MAPI



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old January 5th 07, 11:58 PM posted to microsoft.public.outlook.program_addins
Tom at GSD
external usenet poster
 
Posts: 84
Default Adding a header item with MAPI

Hi,

I have developed an ATL/C++ add-in that I want to add a header item to a
_MailItem before I forward the email. The idea is that I take an item out of
the inbox, modify the header and then forward it to another email address. I
see there are Redemption examples; but I do not want to use the redemption
libraries. Is there an extended MAPI example that will show me how to
accomplish this? I do not want to use any third party utilities. I have
looked for examples on the web but I do not see any.

Thanks,
Tom -


  #2  
Old January 6th 07, 07:18 AM posted to microsoft.public.outlook.program_addins
Dmitry Streblechenko
external usenet poster
 
Posts: 2,116
Default Adding a header item with MAPI

1. Read MailItem.MAPIOBJECT property
2. QI it for IMessage Extended MAPI interface
3. Call IMessage::GetIDsFromNames() passing the appropriate GUID and id
4. "Or" the retirned tag with the appropriate type (PT_STRING8)
5. Use Imessage::SetProps or HrSetOneProp to set the property with tag from
#4.

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

"Tom at GSD" wrote in message
...
Hi,

I have developed an ATL/C++ add-in that I want to add a header item to a
_MailItem before I forward the email. The idea is that I take an item out
of
the inbox, modify the header and then forward it to another email address.
I
see there are Redemption examples; but I do not want to use the redemption
libraries. Is there an extended MAPI example that will show me how to
accomplish this? I do not want to use any third party utilities. I have
looked for examples on the web but I do not see any.

Thanks,
Tom -




  #3  
Old January 6th 07, 04:08 PM posted to microsoft.public.outlook.program_addins
Tom at GSD
external usenet poster
 
Posts: 84
Default Adding a header item with MAPI

Thanks Dmitry - I will give that a try. I was using the following code
snippit but it seemed not to be working properly

IUnknownPtr pUnk = spForward-GetMAPIOBJECT();
CComQIPtrIMAPIProp, &IID_IMAPIProp pMAPIProp(pUnk);
ATLASSERT(pMAPIProp);
SPropTagArray ar = {0};
ULONG nProps = 0;
SPropValue *arProps = NULL;
TCHAR*szResult = NULL;

ar.cValues = 1;
ar.aulPropTag[0] = PR_TRANSPORT_MESSAGE_HEADERS;
pMAPIProp-GetProps(&ar, PT_UNSPECIFIED, &nProps, &arProps);


"Dmitry Streblechenko" wrote:

1. Read MailItem.MAPIOBJECT property
2. QI it for IMessage Extended MAPI interface
3. Call IMessage::GetIDsFromNames() passing the appropriate GUID and id
4. "Or" the retirned tag with the appropriate type (PT_STRING8)
5. Use Imessage::SetProps or HrSetOneProp to set the property with tag from
#4.

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

"Tom at GSD" wrote in message
...
Hi,

I have developed an ATL/C++ add-in that I want to add a header item to a
_MailItem before I forward the email. The idea is that I take an item out
of
the inbox, modify the header and then forward it to another email address.
I
see there are Redemption examples; but I do not want to use the redemption
libraries. Is there an extended MAPI example that will show me how to
accomplish this? I do not want to use any third party utilities. I have
looked for examples on the web but I do not see any.

Thanks,
Tom -





  #4  
Old January 6th 07, 04:17 PM posted to microsoft.public.outlook.program_addins
Dmitry Streblechenko
external usenet poster
 
Posts: 2,116
Default Adding a header item with MAPI

Setting PR_TRANSPORT_MESSAGE_HEADERS on an outgoing message won't do
anything...

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

"Tom at GSD" wrote in message
...
Thanks Dmitry - I will give that a try. I was using the following code
snippit but it seemed not to be working properly

IUnknownPtr pUnk = spForward-GetMAPIOBJECT();
CComQIPtrIMAPIProp, &IID_IMAPIProp pMAPIProp(pUnk);
ATLASSERT(pMAPIProp);
SPropTagArray ar = {0};
ULONG nProps = 0;
SPropValue *arProps = NULL;
TCHAR*szResult = NULL;

ar.cValues = 1;
ar.aulPropTag[0] = PR_TRANSPORT_MESSAGE_HEADERS;
pMAPIProp-GetProps(&ar, PT_UNSPECIFIED, &nProps, &arProps);


"Dmitry Streblechenko" wrote:

1. Read MailItem.MAPIOBJECT property
2. QI it for IMessage Extended MAPI interface
3. Call IMessage::GetIDsFromNames() passing the appropriate GUID and id
4. "Or" the retirned tag with the appropriate type (PT_STRING8)
5. Use Imessage::SetProps or HrSetOneProp to set the property with tag
from
#4.

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

"Tom at GSD" wrote in message
...
Hi,

I have developed an ATL/C++ add-in that I want to add a header item to
a
_MailItem before I forward the email. The idea is that I take an item
out
of
the inbox, modify the header and then forward it to another email
address.
I
see there are Redemption examples; but I do not want to use the
redemption
libraries. Is there an extended MAPI example that will show me how to
accomplish this? I do not want to use any third party utilities. I have
looked for examples on the web but I do not see any.

Thanks,
Tom -







  #5  
Old January 6th 07, 05:01 PM posted to microsoft.public.outlook.program_addins
Tom at GSD
external usenet poster
 
Posts: 84
Default Adding a header item with MAPI

Now it makes sense. :-)

I have been looking for a book or some reference material on MAPI
programming and I have yet to find one. I have a book written by Dave
Grundgeiger; but it is very high level, uses VB and really is a CDO
reference. Do you have any book recommendations?

Thanks!



"Dmitry Streblechenko" wrote:

Setting PR_TRANSPORT_MESSAGE_HEADERS on an outgoing message won't do
anything...

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

"Tom at GSD" wrote in message
...
Thanks Dmitry - I will give that a try. I was using the following code
snippit but it seemed not to be working properly

IUnknownPtr pUnk = spForward-GetMAPIOBJECT();
CComQIPtrIMAPIProp, &IID_IMAPIProp pMAPIProp(pUnk);
ATLASSERT(pMAPIProp);
SPropTagArray ar = {0};
ULONG nProps = 0;
SPropValue *arProps = NULL;
TCHAR*szResult = NULL;

ar.cValues = 1;
ar.aulPropTag[0] = PR_TRANSPORT_MESSAGE_HEADERS;
pMAPIProp-GetProps(&ar, PT_UNSPECIFIED, &nProps, &arProps);


"Dmitry Streblechenko" wrote:

1. Read MailItem.MAPIOBJECT property
2. QI it for IMessage Extended MAPI interface
3. Call IMessage::GetIDsFromNames() passing the appropriate GUID and id
4. "Or" the retirned tag with the appropriate type (PT_STRING8)
5. Use Imessage::SetProps or HrSetOneProp to set the property with tag
from
#4.

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

"Tom at GSD" wrote in message
...
Hi,

I have developed an ATL/C++ add-in that I want to add a header item to
a
_MailItem before I forward the email. The idea is that I take an item
out
of
the inbox, modify the header and then forward it to another email
address.
I
see there are Redemption examples; but I do not want to use the
redemption
libraries. Is there an extended MAPI example that will show me how to
accomplish this? I do not want to use any third party utilities. I have
looked for examples on the web but I do not see any.

Thanks,
Tom -








  #6  
Old January 6th 07, 05:48 PM posted to microsoft.public.outlook.program_addins
Dmitry Streblechenko
external usenet poster
 
Posts: 2,116
Default Adding a header item with MAPI

"Inside MAPI" is the omly MAPI book ever published - it's been out of print
for ages, but you can get it in the PDF format from
http://www.insidemapi.com
It won't cover this particular question of course :-)
Otherwise just post your questions to the
microsoft.public.win32.programmer.messaging newsgroup or use the MAPI list
(http://peach.ease.lsoft.com/Archives/mapi-l.html).

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

"Tom at GSD" wrote in message
...
Now it makes sense. :-)

I have been looking for a book or some reference material on MAPI
programming and I have yet to find one. I have a book written by Dave
Grundgeiger; but it is very high level, uses VB and really is a CDO
reference. Do you have any book recommendations?

Thanks!



"Dmitry Streblechenko" wrote:

Setting PR_TRANSPORT_MESSAGE_HEADERS on an outgoing message won't do
anything...

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

"Tom at GSD" wrote in message
...
Thanks Dmitry - I will give that a try. I was using the following code
snippit but it seemed not to be working properly

IUnknownPtr pUnk = spForward-GetMAPIOBJECT();
CComQIPtrIMAPIProp, &IID_IMAPIProp pMAPIProp(pUnk);
ATLASSERT(pMAPIProp);
SPropTagArray ar = {0};
ULONG nProps = 0;
SPropValue *arProps = NULL;
TCHAR*szResult = NULL;

ar.cValues = 1;
ar.aulPropTag[0] = PR_TRANSPORT_MESSAGE_HEADERS;
pMAPIProp-GetProps(&ar, PT_UNSPECIFIED, &nProps, &arProps);


"Dmitry Streblechenko" wrote:

1. Read MailItem.MAPIOBJECT property
2. QI it for IMessage Extended MAPI interface
3. Call IMessage::GetIDsFromNames() passing the appropriate GUID and
id
4. "Or" the retirned tag with the appropriate type (PT_STRING8)
5. Use Imessage::SetProps or HrSetOneProp to set the property with tag
from
#4.

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

"Tom at GSD" wrote in message
...
Hi,

I have developed an ATL/C++ add-in that I want to add a header item
to
a
_MailItem before I forward the email. The idea is that I take an
item
out
of
the inbox, modify the header and then forward it to another email
address.
I
see there are Redemption examples; but I do not want to use the
redemption
libraries. Is there an extended MAPI example that will show me how
to
accomplish this? I do not want to use any third party utilities. I
have
looked for examples on the web but I do not see any.

Thanks,
Tom -










  #7  
Old January 8th 07, 06:14 PM posted to microsoft.public.outlook.program_addins
Tom at GSD
external usenet poster
 
Posts: 84
Default Adding a header item with MAPI

Hi Again Dmitry,

I ran into a slight issue that I seem not to be able to fix. I am adding the
header information to my out going message; but is seems as though it always
adds the header information as lower case. Is there a way to tell mapi to
ignore the case? In other words if I add a header like "X-MyHeader" it will
show up as "x-myheader".

Thanks,
Tom -

"Dmitry Streblechenko" wrote:

1. Read MailItem.MAPIOBJECT property
2. QI it for IMessage Extended MAPI interface
3. Call IMessage::GetIDsFromNames() passing the appropriate GUID and id
4. "Or" the retirned tag with the appropriate type (PT_STRING8)
5. Use Imessage::SetProps or HrSetOneProp to set the property with tag from
#4.

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

"Tom at GSD" wrote in message
...
Hi,

I have developed an ATL/C++ add-in that I want to add a header item to a
_MailItem before I forward the email. The idea is that I take an item out
of
the inbox, modify the header and then forward it to another email address.
I
see there are Redemption examples; but I do not want to use the redemption
libraries. Is there an extended MAPI example that will show me how to
accomplish this? I do not want to use any third party utilities. I have
looked for examples on the web but I do not see any.

Thanks,
Tom -





  #8  
Old January 8th 07, 06:42 PM posted to microsoft.public.outlook.program_addins
Dmitry Streblechenko
external usenet poster
 
Posts: 2,116
Default Adding a header item with MAPI

AFAIK that's just what the SMTP provider does.
Why is this important? According to all the RFCs MIME headers are not case
sensitive.

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

"Tom at GSD" wrote in message
...
Hi Again Dmitry,

I ran into a slight issue that I seem not to be able to fix. I am adding
the
header information to my out going message; but is seems as though it
always
adds the header information as lower case. Is there a way to tell mapi to
ignore the case? In other words if I add a header like "X-MyHeader" it
will
show up as "x-myheader".

Thanks,
Tom -

"Dmitry Streblechenko" wrote:

1. Read MailItem.MAPIOBJECT property
2. QI it for IMessage Extended MAPI interface
3. Call IMessage::GetIDsFromNames() passing the appropriate GUID and id
4. "Or" the retirned tag with the appropriate type (PT_STRING8)
5. Use Imessage::SetProps or HrSetOneProp to set the property with tag
from
#4.

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

"Tom at GSD" wrote in message
...
Hi,

I have developed an ATL/C++ add-in that I want to add a header item to
a
_MailItem before I forward the email. The idea is that I take an item
out
of
the inbox, modify the header and then forward it to another email
address.
I
see there are Redemption examples; but I do not want to use the
redemption
libraries. Is there an extended MAPI example that will show me how to
accomplish this? I do not want to use any third party utilities. I have
looked for examples on the web but I do not see any.

Thanks,
Tom -







  #9  
Old January 8th 07, 06:54 PM posted to microsoft.public.outlook.program_addins
Tom at GSD
external usenet poster
 
Posts: 84
Default Adding a header item with MAPI

Oh! Okay. I noticed that all the other header elements were not lower case -
that is why I asked. I don't think it will matter; but I had to ask the
question.

Thanks,
Tom -



"Dmitry Streblechenko" wrote:

AFAIK that's just what the SMTP provider does.
Why is this important? According to all the RFCs MIME headers are not case
sensitive.

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

"Tom at GSD" wrote in message
...
Hi Again Dmitry,

I ran into a slight issue that I seem not to be able to fix. I am adding
the
header information to my out going message; but is seems as though it
always
adds the header information as lower case. Is there a way to tell mapi to
ignore the case? In other words if I add a header like "X-MyHeader" it
will
show up as "x-myheader".

Thanks,
Tom -

"Dmitry Streblechenko" wrote:

1. Read MailItem.MAPIOBJECT property
2. QI it for IMessage Extended MAPI interface
3. Call IMessage::GetIDsFromNames() passing the appropriate GUID and id
4. "Or" the retirned tag with the appropriate type (PT_STRING8)
5. Use Imessage::SetProps or HrSetOneProp to set the property with tag
from
#4.

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

"Tom at GSD" wrote in message
...
Hi,

I have developed an ATL/C++ add-in that I want to add a header item to
a
_MailItem before I forward the email. The idea is that I take an item
out
of
the inbox, modify the header and then forward it to another email
address.
I
see there are Redemption examples; but I do not want to use the
redemption
libraries. Is there an extended MAPI example that will show me how to
accomplish this? I do not want to use any third party utilities. I have
looked for examples on the web but I do not see any.

Thanks,
Tom -








 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Item.Save and Item.Close Script causes Outlook 2007 to Crash Rayyan Outlook - Using Forms 6 November 25th 06 03:14 AM
Adding events to a new item lg Add-ins for Outlook 1 August 24th 06 07:53 PM
How to add Custom Header Mail Item [email protected] Outlook - General Queries 2 April 4th 06 10:45 AM
How to add Custom Header to Mail Item racni Add-ins for Outlook 2 April 4th 06 10:36 AM
adding mapi service to outlook 2003 for windows xp [email protected] Outlook - General Queries 3 January 24th 06 07:25 PM


All times are GMT +1. The time now is 12:31 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.