If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
"Cast not valid" error while getting Appointments from outlook(VB.
Hello,
I am writing a VB.Net application, wherein I am trying to get appointments from outlook. The problem i am facing is that,sometimes i am getting an error: "Cast not valid" for the line myAppt = myAppts.GetFirst(). I have observed that i get this error mostly, when i already have the outlook open. Can anyone help me to overcome this problem? Here is the piece of code: Dim myolApp As New outlook.Application Dim olNs As outlook.NameSpace olNs = myolApp.GetNamespace("MAPI") olNs.Logon(, , , False) Dim myAppts As outlook.Items Dim myAppt As outlook.AppointmentItem myAppts = olNs.GetDefaultFolder(outlook.OlDefaultFolders.olF olderCalendar).Items '''''' Restricting the no. of appointments to get to a range of 20 days around today'''' myAppt = myAppts.GetFirst() Do While TypeName(myAppt) "Nothing" ''''Saving the appointments ''''''''' myAppt = myAppts.GetNext() Loop olNs = Nothing System.Runtime.InteropServices.Marshal.ReleaseComO bject(myolApp) -- Thank you, xyz |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
ANNOUNCEMENT: WS:Repeat Appointments II on General Release | Websetters | Calendar | 0 | February 9th, 2005 09:51 PM |
I can't open existing appointments or create new appointments in . | Marissa | Calendar | 1 | November 19th, 2004 04:03 PM |
Group calendar stranegly loses appointments a while after theire m | Tim de Jager | Calendar | 1 | July 21st, 2004 04:51 PM |
appointments disappear and re-appear randomly | Steve Zito | Calendar | 2 | June 14th, 2004 09:34 PM |
Private appointments shown in teamcal.htm (teamcalendar) | Gertjan en Piet | Calendar | 0 | April 29th, 2004 12:47 PM |