Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsWindows Server 2003Windows 2000Windows NTSmall Business ServerVirtual ServerExchange ServerIISHost Integration ServerISA ServerSMSWSUSMOMWindows Media ServerSecurityCertification
Related Topics
SQL ServerMS WindowsMS OfficePC HardwareMore Topics ...

Windows Server Forum / Exchange Server / Applications / November 2006

Tip: Looking for answers? Try searching our database.

Creating a new appointment with CDO 1.2.1

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
John - 22 Nov 2006 15:14 GMT
Hello,

I am using MS Exchange 2003 and MS Outlook 2007. Now I try do develop a
programm, which is able to create new appointments in a calendar of an user.
I try to do this with CDo 1.2.1, but I always get the same error message.
Here is some of my code:

Dim oSession As MAPI.Session ' Session object
Dim oCalendar As MAPI.Folder ' Folder object

oSession = CreateObject("MAPI.Session")
oSession.Logon(, , , , , , "server_xy" & vbLf & "user_ab")
oCalendar =
oSession.GetDefaultFolder(MAPI.CdoDefaultFolderTypes.CdoDefaultFolderCalendar)
Dim msg As MAPI.AppointmentItem
msg = oCalendar.Messages(1)

But Then I get the error message: MAPI_E_NOT_FOUND

Can anyone tell me what I do wrong???

Thanks John
Dan Mitchell - 22 Nov 2006 17:01 GMT
> Dim msg As MAPI.AppointmentItem
> msg = oCalendar.Messages(1)
>
> But Then I get the error message: MAPI_E_NOT_FOUND

Are there any messages in the calendar for that user? You're trying to
_read_ the first message, not create one. To create a new message, use
Messages.Add():

http://msdn.microsoft.com/library/default.asp?url=/library/en-
us/cdo/html/56b1d7aa-6248-4fee-b5e1-a2d6a76e4863.asp

-- dan
John - 23 Nov 2006 07:15 GMT
Sorry,

I forgot to say that the error comes after

oSession.GetDefaultFolder(MAPI.CdoDefaultFolderTypes.CdoDefaultFolderCalendar)

...

> > Dim msg As MAPI.AppointmentItem
> > msg = oCalendar.Messages(1)
[quoted text clipped - 9 lines]
>
>  -- dan
Dan Mitchell - 23 Nov 2006 18:07 GMT
> I forgot to say that the error comes after
>
> oSession.GetDefaultFolder(MAPI.CdoDefaultFolderTypes.CdoDefaultFolderCa
> lendar)

Do you mean _after_ that line, or is it that exact line that's causing
the problem?

Does the user actually have a calendar folder yet? If you haven't run
Outlook and pointed it at the user's mailbox (or presumably some other
appropriate Exchange setup tool), there may not be the standard set of
folders there..

-- dan
John - 24 Nov 2006 07:15 GMT
It is exacly this line that causes the error.

I am working with my exchange profile and I have a calender yet. Or does
calendar folder mean something different?
How can I see if there is a set of standard folders?

John
Dan Mitchell - 24 Nov 2006 16:36 GMT
> It is exacly this line that causes the error.

Okay.

> I am working with my exchange profile and I have a calender yet. Or does
> calendar folder mean something different?
> How can I see if there is a set of standard folders?

If you can open the calendar in Outlook, you have a calendar, there's
nothing complicated here. I was just wondering if this was a profile
that's never been used before.

(you can also use mdbview or mfcmapi to poke around, but that shouldn't
make a difference).

Are you sure your code is successfully logging in? What happens if you
try and read the first message from the Inbox instead of the calendar
folder? (or even simpler, get the name of the Inbox folder).

CDO1.21 doesn't throw logon errors at the Logon line, it throws them at
the first line of code that tries to actually do something, which in
your case would be the GetDefaultFolder call.

-- dan
Lee Derbyshire [MVP] - 23 Nov 2006 13:42 GMT
> Hello,
>
[quoted text clipped - 9 lines]
> oSession.Logon(, , , , , , "server_xy" & vbLf & "user_ab")
> oCalendar =

oSession.GetDefaultFolder(MAPI.CdoDefaultFolderTypes.CdoDefaultFolderC
alendar)
> Dim msg As MAPI.AppointmentItem
> msg = oCalendar.Messages(1)
[quoted text clipped - 4 lines]
>
> Thanks John

You will also get that error message if the folder pointed to by the
registry key described here:

http://support.microsoft.com/kb/166599

does not exist.

Lee.

Signature

_______________________________________

Outlook Web Access For PDA , OWA For WAP
www.owapda.com
email a@t leederbyshire d.0.t c.0.m
_______________________________________

 
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



©2009 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.