Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

CDO Message Forwarding Issue.

9 views
Skip to first unread message

Bakshi

unread,
Jan 23, 2008, 12:56:50 AM1/23/08
to
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 = "us...@exchange.pro.com"
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

Ken Slovak - [MVP - Outlook]

unread,
Jan 23, 2008, 9:54:10 AM1/23/08
to
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.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm


"Bakshi" <RSBa...@gmail.com> wrote in message
news:3f8cd1d1-9f0f-4d3e...@c4g2000hsg.googlegroups.com...

Norman Yuan

unread,
Jan 25, 2008, 3:27:39 PM1/25/08
to
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.


"Ken Slovak - [MVP - Outlook]" <kens...@mvps.org> wrote in message
news:O6U1S$cXIHA...@TK2MSFTNGP03.phx.gbl...

Ken Slovak - [MVP - Outlook]

unread,
Jan 25, 2008, 4:03:13 PM1/25/08
to
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.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm


"Norman Yuan" <Fake...@FakeEmail.Not> wrote in message
news:OGV%237C5XI...@TK2MSFTNGP06.phx.gbl...

Norman Yuan

unread,
Jan 25, 2008, 6:32:27 PM1/25/08
to
Thanks for the info.

"Ken Slovak - [MVP - Outlook]" <kens...@mvps.org> wrote in message

news:uKiw7W5X...@TK2MSFTNGP05.phx.gbl...

0 new messages