Need help scraping calendar info

  • Thread starter Thread starter rut
  • Start date Start date
R

rut

Can anyone guide me to some samples as to how to get the data
(programatically) from an outlook calendar? I need this in vb.net code
for a program I am writing to grab the data to populate a sql server
db.

Thanks
Rut
 
This code is a good starting point:

Imports System.Reflection

Module Module1

Sub Main()
' Create Outlook application.
Dim oApp As Outlook.Application = New Outlook.Application

' Get namespace and Contacts folder reference.
Dim oNS As Outlook.NameSpace = oApp.GetNamespace("MAPI")
Dim oAppointments As Outlook.MAPIFolder =
oNS.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderCalendar)

' Get the first contact from the Contacts folder.
Dim oItems As Outlook.Items = oAppointments.Items
Dim oAppt As Outlook.AppointmentItem

Dim iCount As Int16
iCount = 0

oAppt = oItems.GetFirst()

Do While Not oAppt Is Nothing
iCount += 1

' Display some common properties.
Console.WriteLine(oAppt.Subject)
Console.WriteLine(oAppt.Start)
oAppt = oItems.GetNext
Loop

Console.WriteLine(iCount)

' Clean up.
oApp = Nothing
oItems = Nothing
oAppt = Nothing

End Sub
End Module
 
Thanks. I'm a little confused though. Does this bring back contacts or
calendar infor?

Also, would this work going directly against the exchange server?

Thanks,
Rut
 
I am new to vba in outlook but I think he meant

It's a great start though to explain the object model and you should give a
whirl
 
Back
Top