exchangefreaks.com Forum Index
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Creating a new appointment with CDO 1.2.1

 
Post new topic   Reply to topic    exchangefreaks.com Forum Index -> MS Exchange Applications
Author Message
John



Joined: 05 Aug 2007
Posts: 53

PostPosted: Wed Nov 22, 2006 12:14 pm    Post subject: Creating a new appointment with CDO 1.2.1 Reply with quote

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

Archived from group: microsoft>public>exchange>applications
Back to top
View user's profile Send private message
Dan Mitchell



Joined: 05 Aug 2007
Posts: 42

PostPosted: Wed Nov 22, 2006 2:01 pm    Post subject: Re: Creating a new appointment with CDO 1.2.1 Reply with quote

=?Utf-8?B?Sm9obg==?= wrote in@microsoft.com:
> 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
Back to top
View user's profile Send private message
John



Joined: 05 Aug 2007
Posts: 53

PostPosted: Thu Nov 23, 2006 4:15 am    Post subject: Re: Creating a new appointment with CDO 1.2.1 Reply with quote

Sorry,

I forgot to say that the error comes after

oSession.GetDefaultFolder(MAPI.CdoDefaultFolderTypes.CdoDefaultFolderCalendar)

....

"Dan Mitchell" wrote:

> =?Utf-8?B?Sm9obg==?= wrote in
> @microsoft.com:
> > 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
>
Back to top
View user's profile Send private message
Dan Mitchell



Joined: 05 Aug 2007
Posts: 42

PostPosted: Thu Nov 23, 2006 3:07 pm    Post subject: Re: Creating a new appointment with CDO 1.2.1 Reply with quote

=?Utf-8?B?Sm9obg==?= wrote in@microsoft.com:
> 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
Back to top
View user's profile Send private message
Lee Derbyshire [MVP]



Joined: 05 Aug 2007
Posts: 363

PostPosted: Thu Nov 23, 2006 6:42 pm    Post subject: Re: Creating a new appointment with CDO 1.2.1 Reply with quote

"John" wrote in message@microsoft.com...
> 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.CdoDefaultFolderC
alendar)
> 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

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.

--
_______________________________________

Outlook Web Access For PDA , OWA For WAP
www.owapda.com
email a@t leederbyshire d.0.t c.0.m
_______________________________________
Back to top
View user's profile Send private message
John



Joined: 05 Aug 2007
Posts: 53

PostPosted: Fri Nov 24, 2006 4:15 am    Post subject: Re: Creating a new appointment with CDO 1.2.1 Reply with quote

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
Back to top
View user's profile Send private message
Dan Mitchell



Joined: 05 Aug 2007
Posts: 42

PostPosted: Fri Nov 24, 2006 1:36 pm    Post subject: Re: Creating a new appointment with CDO 1.2.1 Reply with quote

=?Utf-8?B?Sm9obg==?= wrote in @microsoft.com:
> 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

Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    exchangefreaks.com Forum Index -> MS Exchange Applications All times are GMT
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2005 phpBB Group