Access and Outlook Calendar

P

PeterM

I've searched thru this forum and thru the Outlook forum and can't find
exactly the issue I need to resolve. I have developed a calendar in AC2003. I
have developed a process to export the calendar entry from access to the
outlook calendar which works great. My user is now requesting the ability to
view (or thru VBA) the entries in the Outlook calendar from within access?
Unfortunately my database has no way to know if an entry in the access
database already exists in the Outlook calendar. Is there a way to determine
that?

I tried creating a linked table with Outlook successfully and did connect to
my calendar via Linked Tables however, when I look at the outlook calendar
in my Access database it's missing the date of the event. It has almost
everything else, but no date which I need to check for duplicates with my
access database.

I used both Outlook() and Exchange() as the type for the table link and got
the same results.

What am I missing?

Thanks for your insight...
 
M

Marco Pagliero

I've searched thru this forum and thru the Outlook forum and can't find
..
I tried creating a linked table with Outlook successfully and did connect to
my calendar via Linked Tables however, when I look at the outlook calendar
in my Access database it's missing the date of the event. It has almost
everything else, but no date which I need to check for duplicates with my
access database.
Yes, the wizard does use the same template for all folders and there
is no special template for Calendar. There is no chance to get this
right in any version of Access beside modifying the wizard but I could
not find any way to do this..

The other way is automation but I didn't find a complete solution so I
collected all informations I could find to get these fields from
outlook. My subroutine shows how you get the informations, afterwards
you have to digest them and pass them to Access to compare. Maybe
create everytime a temporary table with the current appointments to
compare with the old ones. Anyway here goes:

----------------------------------------------------
Sub getOutlookCalendar()
Open "k:\test.txt" For Output As #1
Set myObj = CreateObject("Outlook.Application")
Set myMapi = myObj.GetNamespace("Mapi")
Set myFdr = myMapi.Folders

'MsgBox myFdr.Count 'can be more than one (profiles
and .pst)
'MsgBox myFdr(1).Name 'name of the .pst
nFdr = myFdr(1).Folders.Count 'we take the first one anyway
Print #1, "Folders", nFdr
For i = 1 To nFdr
Print #1, i, myFdr(1).Folders(i).Name
If InStr(myFdr(1).Folders(i).Name, "alend") > 0 Then iCal = i
'Calendar: Should work for several languages
Next
Print #1, ""
'Calendar = 5
nIts = myFdr(1).Folders(iCal).Items.Count
Print #1, "Items", nIts

For i = 1 To nIts
Print #1, i, myFdr(1).Folders(iCal).Items(i).Start
Print #1, i, myFdr(1).Folders(iCal).Items(i).Duration
Print #1, i, myFdr(1).Folders(iCal).Items(i).Subject
Print #1, ""
Next

Set myObj = Nothing
Set myMapi = Nothing
Set myFdr = Nothing
Close #1
MsgBox "done"
End Sub
----------------------------------------------------
The number of .pst can vary and the folder names are localised and
partly user defined, so you need first to find out the index of the
Appointments folder you need (iCal). If there is only one and it
contains the string "alend" in the name, the sub finds it.

Start (this is the complete date+time), duration and subject should
suffice to distinguish new from old appointments. For the sub to run
you need to activate the "Microsoft Outlook Object Library" under
tools/references in the VB editor of MS-Access.

Greetings
Marco P
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top