CDO Message Forwarding Issue.

  • Thread starter Thread starter Bakshi
  • Start date Start date
B

Bakshi

The reference is Microsoft CDO 1.21 Library.


--Source Code Begiin---

Imports Microsoft.VisualBasic
Imports System.IO
Imports System.Text
Imports Microsoft.Win32
Imports System
Imports System.Management
Imports System.Collections.ObjectModel
Imports MAPI

Public Class Form1

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim objSession As MAPI.Session
Dim MailBox As MAPI.Messages
Dim InMessage, fwdMessage As MAPI.Message
Dim recp

objSession = CreateObject("MAPI.Session")
objSession.Logon(ProfileName:="admin",
ProfilePassword:="al1234_BB")

MailBox = objSession.Inbox.Messages
InMessage = MailBox.GetFirst

fwdMessage = InMessage.Forward //Getting Exception here..
Recp = fwdMessage.Recipients.Add
Recp.Name = "(e-mail address removed)"
Recp.Resolve()
fwdMessage.Send()
objSession.Logoff()
objSession = Nothing
End Sub

End Class

--Source Code End---

Exception : MAPI_E_UNKNOWN_ENTRYID(80040201)

How to overcome this problem?

Thanks
 
Don't use CDO 1.21 in managed code, it's not supported.

Why use CDO for your code anyway, there's nothing special in there that
can't be done by using the Outlook object model, which is supported for
managed code.
 
How do you find out if "Out-Of_Office" flag is set? CDO's Session object has
properties OutOfOffice and OutOfOfficeText, but I could not find a way to
get this with Outlook objecy model.
 
That's not exposed directly in the Outlook object model.

To get out of office state in Outlook 2007 you'd use the default Store
object and the PropertyAccessor to look at PR_OOF_STATE (0x661D000B or
http://schemas.microsoft.com/mapi/proptag/0x661D000B in DASL).

In earlier versions of Outlook you'd have to use CDO or Redemption or
Extended MAPI, but again CDO and Extended MAPI aren't supported in managed
code.

Out of office text is stored in a hidden message in the Inbox with a
MessageClass of "IPM.Note.Rules.OofTemplate.Microsoft". The text is in the
body property of that hidden message.
 
Thanks for the info.

Ken Slovak - said:
That's not exposed directly in the Outlook object model.

To get out of office state in Outlook 2007 you'd use the default Store
object and the PropertyAccessor to look at PR_OOF_STATE (0x661D000B or
http://schemas.microsoft.com/mapi/proptag/0x661D000B in DASL).

In earlier versions of Outlook you'd have to use CDO or Redemption or
Extended MAPI, but again CDO and Extended MAPI aren't supported in managed
code.

Out of office text is stored in a hidden message in the Inbox with a
MessageClass of "IPM.Note.Rules.OofTemplate.Microsoft". The text is in the
body property of that hidden message.
 
Back
Top