Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Outlook / Programming VBA / April 2005

Tip: Looking for answers? Try searching our database.

X-Fields in the headers

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Trudeu - 19 Apr 2005 14:57 GMT
Im trying to add X-fields to my out going outlook 2000.

I found this great link which in theory tells me exactly how to do this.
I have loaded redemption version 3.4.0.402, Removed the '| characters,
pasted it into "this outlook session", saved closed,  but all I get is the
error message "There has been an error adding headers". (at  least that
works)

http://www.sd-il.com/HabeasHeaders.html

I'm not using Habeas but figure I can remove most of the x fields and then
put my own text into the X-Habeas lines.

I have looked at the redemption site but Im afraid my knowledge does not get
me to the point where I can use the examples they provide.
They appear to be snippets, which I dont know how to integrate into a
working script.

Can anyone help me with what I'm doing wrong, or perhaps provide an example
of how to do this?

Thanks
Dmitry Streblechenko - 19 Apr 2005 18:46 GMT
What is your latest code? Which line of code produces the error?

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

> Im trying to add X-fields to my out going outlook 2000.
>
[quoted text clipped - 20 lines]
>
> Thanks
Trudeu - 19 Apr 2005 20:34 GMT
Mr. Streblechenko,
Thanks for your response.
I'm not sure what you mean by what is your latest Code ? If you mean what
Redemption I'm using the Dll says Vers. 3.4.0.402. The actual script Im
using is at http://www.sd-il.com/HabeasHeaders.html . I will post it at the
BOTTOM of this email for clarity. Note that I have put at the end of the
lines, numbers '1 to '11 showing the sequence of how the program is
executed. I think that it is at '8 that it is failing. That is once it runs
that line it then goes to the error message, '9.

PrId = utils.GetIDsFromNames(Item.MAPIOBJECT,
"{00020386-0000-0000-C000-000000000046}", localProp, True) '8

I hope this is the information you are looking for.
Thank you.

> What is your latest code? Which line of code produces the error?
>
[quoted text clipped - 27 lines]
> >
> > Thanks

-----------The code I copied ----
Dim utils

Private Sub Add_X_Header(ByVal Item As Object, Prop, Val As String)
'5

   Const PT_STRING8 = &H1E

   Dim PrId As Long
   Dim localProp As String
   Dim localVal As String
   Dim foo As Integer

   localProp = Prop
'6
   localVal = Val
'7

   ' set high word of PrID to Property Id of Extended Header; create if
necessary
   PrId = utils.GetIDsFromNames(Item.MAPIOBJECT,
"{00020386-0000-0000-C000-000000000046}", localProp, True) '8

   ' set the low word to PT_STRING8
   PrId = PrId + PT_STRING8

   foo = utils.HrSetOneProp(Item.MAPIOBJECT, PrId, localVal, True)

End Sub

Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
'1

   Set utils = CreateObject("Redemption.MAPIUtils")
'2

   On Error GoTo errorExit
'3
   Add_X_Header Item, "X-Habeas-SWE-1", "winter into spring"
'4
   Add_X_Header Item, "X-Habeas-SWE-2", "brightly anticipated"
   Add_X_Header Item, "X-Habeas-SWE-3", "like Habeas SWE (tm)"
   Add_X_Header Item, "X-Habeas-SWE-4", "Copyright 2002 Habeas (tm)"
   Add_X_Header Item, "X-Habeas-SWE-5", "Sender Warranted Email (SWE) (tm).
The sender of this"
   Add_X_Header Item, "X-Habeas-SWE-6", "email in exchange for a license
for this Habeas"
   Add_X_Header Item, "X-Habeas-SWE-7", "warrant mark warrants that this is
a Habeas Compliant"
   Add_X_Header Item, "X-Habeas-SWE-8", "Message (HCM) and not spam. Please
report use of this"
   Add_X_Header Item, "X-Habeas-SWE-9", "mark in spam to
<http://www.habeas.com/report/>;."
   Set utils = Nothing

   Cancel = False
   Exit Sub

errorExit:
   MsgBox "There has been an error adding headers"
'9
   Cancel = True
'10

End Sub
'11
Dmitry Streblechenko - 21 Apr 2005 23:55 GMT
Try to use false as the last parameter when calling HrSetOneProp:

foo = utils.HrSetOneProp(Item.MAPIOBJECT, PrId, localVal, false)

What is the error message? Try to modify your error handler as follows:

errorExit:
   MsgBox "There has been an error adding headers - " & Err.Description

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

> Mr. Streblechenko,
> Thanks for your response.
[quoted text clipped - 119 lines]
> End Sub
> '11
Macdonald - 27 Apr 2005 14:44 GMT
I have done what you have listed. It still fails. The error message is that
there is a "object required"
Thanks.

> Try to use false as the last parameter when calling HrSetOneProp:
>
[quoted text clipped - 133 lines]
> > End Sub
> > '11
Dmitry Streblechenko - 27 Apr 2005 21:26 GMT
What is your code?

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

>I have done what you have listed. It still fails. The error message is that
> there is a "object required"
[quoted text clipped - 147 lines]
>> > End Sub
>> > '11
Macdonald - 28 Apr 2005 14:49 GMT
Here it is with your changes. Other Redemption code works.

Thanks.

'-----START -- OF CODE ----------

Dim utils

Private Sub Add_X_Header(ByVal Item As Object, Prop, Val As String)

   Const PT_STRING8 = &H1E

   Dim PrId As Long

   Dim localProp As String

   Dim localVal As String

   Dim foo As Integer

   localProp = Prop

   localVal = Val

   ' set high word of PrID to Property Id of Extended Header; create if
necessary

   PrId = utils.GetIDsFromNames(Item.MAPIOBJECT, _

       "{00020386-0000-0000-C000-000000000046}", localProp, True)

   ' set the low word to PT_STRING8

   PrId = PrId + PT_STRING8

   ' foo = utils.HrSetOneProp(Item.MAPIOBJECT, PrId, localVal, True)

   foo = utils.HrSetOneProp(Item.MAPIOBJECT, PrId, localVal, False)

End Sub

Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)

   Set utils = CreateObject("Redemption.MAPIUtils")

   On Error GoTo errorExit

   Add_X_Header Item, "X-Habeas-SWE-1", "winter into spring"

   Add_X_Header Item, "X-Habeas-SWE-2", "brightly anticipated"

   Add_X_Header Item, "X-Habeas-SWE-3", "like Habeas SWE (tm)"

   Add_X_Header Item, "X-Habeas-SWE-4", "Copyright 2002 Habeas (tm)"

   Add_X_Header Item, "X-Habeas-SWE-5", "Sender Warranted Email (SWE) (tm).
The sender of this"

   Add_X_Header Item, "X-Habeas-SWE-6", "email in exchange for a license fo
r this Habeas"

   Add_X_Header Item, "X-Habeas-SWE-7", "warrant mark warrants that this is
a Habeas Compliant"

   Add_X_Header Item, "X-Habeas-SWE-8", "Message (HCM) and not spam. Please
report use of this"

   Add_X_Header Item, "X-Habeas-SWE-9", "mark in spam to
<http://www.habeas.com/report/>;."

   Set utils = Nothing

   Cancel = False

   Exit Sub

errorExit:

   MsgBox "There has been an error adding headers"

   Cancel = True

'errorExit:

   MsgBox "There has been an error adding headers - " & Err.Description

End Sub

'--------------END OF CODE ---------

> What is your code?
>
[quoted text clipped - 154 lines]
> >> > End Sub
> >> > '11
Dmitry Streblechenko - 28 Apr 2005 18:44 GMT
Which line is causing the error? Is utils object successfully created?

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

> Here it is with your changes. Other Redemption code works.
>
[quoted text clipped - 262 lines]
>> >> > End Sub
>> >> > '11
trudeu@maison.com - 28 Apr 2005 20:10 GMT
Mr Streblechenko,

As I had mentioned earlier, Im a novice at this so I may not be able to give
you the answer that you are looking for.
I can tell you that when I step into the routine it is right after the line

PrId = utils.GetIDsFromNames(Item.MAPIOBJECT,
"{00020386-0000-0000-C000-000000000046}", localProp, True)
that it fails. The value of PrId when I put my cursor over it is "0".

Im not sure what utils object is, (maybe thats the problem.)

thanks.

> Which line is causing the error? Is utils object successfully created?
>
[quoted text clipped - 269 lines]
> >> >> > End Sub
> >> >> > '11
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.