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

Help with 'MailItem' object of WordMail Inspector



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old May 17th 06, 10:27 PM posted to microsoft.public.outlook.program_addins
[email protected]
external usenet poster
 
Posts: 2
Default Help with 'MailItem' object of WordMail Inspector

I have created an Outlook addin that was originally designed to do some
processing on a selected mail item in an explorer and it works great.
One of the things it does is a "SaveAs" to html format and then send
the html version of the email to a web service.

I now have a requirement to be able to do the same processing on a NEW
email from within the inspector. The requirement is that I add a new
button that does this processing AND sends the mail item so the user
just has to click one button.

My first attempt was to get the CurrentItem of the Inspector and pass
it to my class that handles all of the processing of the mail item.
After the processing was done, I was going to call the Send method of
the item to send it and be done.

However, I am finding now that my class designed to process mail items
doesnt work when the mailitem points to the currentitem of an
inspector. One problem is that when I attempt to do the SaveAs to HTML
format, I get RTF garbage at the top which I'm assuming is coming from
the word editor. Another thing my class does is save the email
attachments and send them to a web service. However, the attachments
are not saving correctly. It seems reasonable that there are many
differences between a MailItem coming from an explorer and the
CurrentItem coming from the WordMail editor. I dont wish to rewrite my
class to work on both items. It seems the simplest solution would be
to go ahead and send the new mail first, and then pass that mailitem to
my class afterwards. I tried this, however I get the error that "The
Item was Moved".

Any suggestion on how I can get a reference to the email either before
or after it is sent so that the MailItem object looks and behaves just
like the MailItem objects from an Explorer?

I also tried calling "Save" to save the mail to drafts and then access
the currentitem but had the same problems.

Here's the sample of code that works.

Dim selObject As Object =
Me.ActiveExplorer.Selection.Item(1)
If (TypeOf selObject Is Outlook.MailItem) Then
Dim wizard As New AREMIS(CType(selObject,
Outlook.MailItem))
wizard.ShowDialog()
End If

Here's the sample of code that doesnt work.

Dim mi As Outlook.MailItem =
CType(Me.ActiveInspector.CurrentItem, Outlook.MailItem)
'mi.Send() 'tried sending it first but got error object was
moved
'mi.Save() 'tried saving it first but didnt make a
difference
Dim wizard As New AREMIS(mi)
wizard.ShowDialog()

Thanks in advance for your help!

  #2  
Old May 18th 06, 08:17 PM posted to microsoft.public.outlook.program_addins
Dmitry Streblechenko
external usenet poster
 
Posts: 2,116
Default Help with 'MailItem' object of WordMail Inspector

Do you call MailItem.Save before you call SaveAs?

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

wrote in message
oups.com...
I have created an Outlook addin that was originally designed to do some
processing on a selected mail item in an explorer and it works great.
One of the things it does is a "SaveAs" to html format and then send
the html version of the email to a web service.

I now have a requirement to be able to do the same processing on a NEW
email from within the inspector. The requirement is that I add a new
button that does this processing AND sends the mail item so the user
just has to click one button.

My first attempt was to get the CurrentItem of the Inspector and pass
it to my class that handles all of the processing of the mail item.
After the processing was done, I was going to call the Send method of
the item to send it and be done.

However, I am finding now that my class designed to process mail items
doesnt work when the mailitem points to the currentitem of an
inspector. One problem is that when I attempt to do the SaveAs to HTML
format, I get RTF garbage at the top which I'm assuming is coming from
the word editor. Another thing my class does is save the email
attachments and send them to a web service. However, the attachments
are not saving correctly. It seems reasonable that there are many
differences between a MailItem coming from an explorer and the
CurrentItem coming from the WordMail editor. I dont wish to rewrite my
class to work on both items. It seems the simplest solution would be
to go ahead and send the new mail first, and then pass that mailitem to
my class afterwards. I tried this, however I get the error that "The
Item was Moved".

Any suggestion on how I can get a reference to the email either before
or after it is sent so that the MailItem object looks and behaves just
like the MailItem objects from an Explorer?

I also tried calling "Save" to save the mail to drafts and then access
the currentitem but had the same problems.

Here's the sample of code that works.

Dim selObject As Object =
Me.ActiveExplorer.Selection.Item(1)
If (TypeOf selObject Is Outlook.MailItem) Then
Dim wizard As New AREMIS(CType(selObject,
Outlook.MailItem))
wizard.ShowDialog()
End If

Here's the sample of code that doesnt work.

Dim mi As Outlook.MailItem =
CType(Me.ActiveInspector.CurrentItem, Outlook.MailItem)
'mi.Send() 'tried sending it first but got error object was
moved
'mi.Save() 'tried saving it first but didnt make a
difference
Dim wizard As New AREMIS(mi)
wizard.ShowDialog()

Thanks in advance for your help!



  #3  
Old May 18th 06, 08:28 PM posted to microsoft.public.outlook.program_addins
[email protected]
external usenet poster
 
Posts: 2
Default Help with 'MailItem' object of WordMail Inspector

Yes, that was one of the things I tried, as you can see the commented
mi.Save in the code above.

I think I have narrowed it down now so that the only descrepency I have
between a new email and existing email is that when you call "SaveAs"
on an item in the WordMail editor you get a bunch of RTF junk at the
top of the msg. If I could get rid of this, my problem would be
solved.

 




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
Read body of MailItem ? Trey Shaffer Outlook and VBA 1 March 18th 06 08:56 PM
how to detect programmatically if some code is runing in wordmail Herve cadieu Outlook and VBA 5 March 14th 06 04:36 PM
How can I create a MailItem that displays like a received MailItem ? Clive Outlook - Using Forms 0 February 27th 06 05:14 PM
Help! Inspector.Close is fired before Inspector.Activate handler finishes Sergey Anchipolevsky Add-ins for Outlook 8 February 9th 06 10:51 AM
dialog comes up when trying to access mailItem Neo Add-ins for Outlook 3 January 16th 06 10:56 PM


All times are GMT +1. The time now is 11:43 AM.


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.