R
rodzilla
I am having problems when accessing Outlook's default Calendar folder
after "exiting" Outlook - ie Outlook's main form closed, but Outlook's
icon still resident in the taskbar. Since Outlook is frequently in this
state, I need a solution that deals with all possible states....
The code below just loops through the Calendar appointment items...It
runs fine when Outlook is either visible-and-running, or when Outlook
is completely stopped and not memory resident (I exit Outlook and then
completely kill Outlook with Windows Task Manager).
The code below encounters NO AppointmenItems when Outlook is in the
memory-resident/icon-only in-between state.
I have tried the same routine using:
oNS.Logon( , , , True)
to try force a new Outlook session, but the problem is the same...
Any help is GREATLY appreciated
Rod Kimmel
------------------------------------------------------------------------------------
oApp = CreateObject("Outlook.Application")
oNS = oApp.GetNamespace("mapi")
oNS.Logon()
Dim oCalendar As Outlook.MAPIFolder =
oNS.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderCalendar)
Dim oItems As Outlook.Items = oCalendar.Items
If oItems.Count > 0 Then
Dim ictr As Integer
Dim oAppt As Outlook.AppointmentItem
Dim myObj As Object = oItems.GetFirst
For ictr = 1 To oItems.Count
If TypeOf (myObj) Is Outlook.AppointmentItem Then
oAppt = CType(myObj, Outlook.AppointmentItem)
...
End If
End IF
-------------------------------------------------------------------------------------------
after "exiting" Outlook - ie Outlook's main form closed, but Outlook's
icon still resident in the taskbar. Since Outlook is frequently in this
state, I need a solution that deals with all possible states....
The code below just loops through the Calendar appointment items...It
runs fine when Outlook is either visible-and-running, or when Outlook
is completely stopped and not memory resident (I exit Outlook and then
completely kill Outlook with Windows Task Manager).
The code below encounters NO AppointmenItems when Outlook is in the
memory-resident/icon-only in-between state.
I have tried the same routine using:
oNS.Logon( , , , True)
to try force a new Outlook session, but the problem is the same...
Any help is GREATLY appreciated
Rod Kimmel
------------------------------------------------------------------------------------
oApp = CreateObject("Outlook.Application")
oNS = oApp.GetNamespace("mapi")
oNS.Logon()
Dim oCalendar As Outlook.MAPIFolder =
oNS.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderCalendar)
Dim oItems As Outlook.Items = oCalendar.Items
If oItems.Count > 0 Then
Dim ictr As Integer
Dim oAppt As Outlook.AppointmentItem
Dim myObj As Object = oItems.GetFirst
For ictr = 1 To oItems.Count
If TypeOf (myObj) Is Outlook.AppointmentItem Then
oAppt = CType(myObj, Outlook.AppointmentItem)
...
End If
End IF
-------------------------------------------------------------------------------------------