 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Leonid Zeitlin Guest
|
Posted: Thu Jun 26, 2003 5:38 pm Post subject: Setting RTF body of an Appointment item in Outlook |
|
|
Hello all,
I have the following problem. I need to create an Appointment or Task item
in Outlook and set its body with RTF formatting. I know how to create the
item with Outlook object mode, but I see that Outlook object model does not
provide access to the RTF body and thus I need to get down to MAPI level. I
thought I could get the IMessage interface of the Appointment item from its
Outlook _AppointmentItem inteface by calling
AppointmentItem.MapiObject.QueryInterface with IMessage IID. But this
QueryInterface fails with E_FAIL return code. Can anyone comment why this
happens?
I tried a different route. I start a new MAPI session with MAPILogonEx, open
the message store that contains my Appointment with Session.OpenMsgStore
(passing MAPI_MODIFY for flags, since I need to modify my Appointment), and
then use the store object to get to my Appointment with MsgStore.OpenEntry,
again passing MAPI_MODIFY flag. This fails with MAPI_E_NO_ACCESS. The folder
where the Appointment is located is my personal Calendar folder, so I have
all access rights for it. If I try to do MsgStore.OpenEntry without
MAPI_MODIFY flag, the call successds, but then, obviously, I cannot modify
the Appointment.
Any help would be appreciated. Thanks.
Leonid.
|
|
| Back to top |
|
 |
Dmitry Streblechenko Guest
|
Posted: Thu Jun 26, 2003 6:08 pm Post subject: Re: Setting RTF body of an Appointment item in Outlook |
|
|
1. If your code is running in a thread other than the main Outlook thread
(i.e. your code in not in an addin), you need to call MAPIInitalize() before
doing anything MAPI related, including QI'ing for IMessage.
2. I don't think MAPI_MODIFY is a valid flag for
IMAPISession.OpenMsgStore(). Try MAPI_BEST_ACCESS or MDB_WRITE instead.
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
"Leonid Zeitlin" <lz (AT) csltd (DOT) com.ua> wrote
| Quote: | Hello all,
I have the following problem. I need to create an Appointment or Task item
in Outlook and set its body with RTF formatting. I know how to create the
item with Outlook object mode, but I see that Outlook object model does
not
provide access to the RTF body and thus I need to get down to MAPI level.
I
thought I could get the IMessage interface of the Appointment item from
its
Outlook _AppointmentItem inteface by calling
AppointmentItem.MapiObject.QueryInterface with IMessage IID. But this
QueryInterface fails with E_FAIL return code. Can anyone comment why this
happens?
I tried a different route. I start a new MAPI session with MAPILogonEx,
open
the message store that contains my Appointment with Session.OpenMsgStore
(passing MAPI_MODIFY for flags, since I need to modify my Appointment),
and
then use the store object to get to my Appointment with
MsgStore.OpenEntry,
again passing MAPI_MODIFY flag. This fails with MAPI_E_NO_ACCESS. The
folder
where the Appointment is located is my personal Calendar folder, so I have
all access rights for it. If I try to do MsgStore.OpenEntry without
MAPI_MODIFY flag, the call successds, but then, obviously, I cannot modify
the Appointment.
Any help would be appreciated. Thanks.
Leonid.
|
|
|
| Back to top |
|
 |
Leonid Zeitlin Guest
|
Posted: Fri Jun 27, 2003 10:16 am Post subject: Re: Setting RTF body of an Appointment item in Outlook |
|
|
Dmitry, thanks a lot for your tip to call MAPIInitalize before requesting
IMessage interface. That did the trick.
Thanks,
Leonid
"Dmitry Streblechenko" <dmitry (AT) dimastr (DOT) com> сообщил/сообщила в новостях
следующее: news:3efb36a4$1 (AT) newsgroups (DOT) borland.com...
| Quote: | 1. If your code is running in a thread other than the main Outlook thread
(i.e. your code in not in an addin), you need to call MAPIInitalize()
before
doing anything MAPI related, including QI'ing for IMessage.
2. I don't think MAPI_MODIFY is a valid flag for
IMAPISession.OpenMsgStore(). Try MAPI_BEST_ACCESS or MDB_WRITE instead.
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
"Leonid Zeitlin" <lz (AT) csltd (DOT) com.ua> wrote in message
news:3efb2f94 (AT) newsgroups (DOT) borland.com...
Hello all,
I have the following problem. I need to create an Appointment or Task
item
in Outlook and set its body with RTF formatting. I know how to create
the
item with Outlook object mode, but I see that Outlook object model does
not
provide access to the RTF body and thus I need to get down to MAPI
level.
I
thought I could get the IMessage interface of the Appointment item from
its
Outlook _AppointmentItem inteface by calling
AppointmentItem.MapiObject.QueryInterface with IMessage IID. But this
QueryInterface fails with E_FAIL return code. Can anyone comment why
this
happens?
I tried a different route. I start a new MAPI session with MAPILogonEx,
open
the message store that contains my Appointment with Session.OpenMsgStore
(passing MAPI_MODIFY for flags, since I need to modify my Appointment),
and
then use the store object to get to my Appointment with
MsgStore.OpenEntry,
again passing MAPI_MODIFY flag. This fails with MAPI_E_NO_ACCESS. The
folder
where the Appointment is located is my personal Calendar folder, so I
have
all access rights for it. If I try to do MsgStore.OpenEntry without
MAPI_MODIFY flag, the call successds, but then, obviously, I cannot
modify
the Appointment.
Any help would be appreciated. Thanks.
Leonid.
|
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|