View Single Post
  #2  
Old July 4th 06, 04:29 PM posted to microsoft.public.outlook.program_vba
Eric Legault [MVP - Outlook]
external usenet poster
 
Posts: 830
Default Need help scraping calendar info

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.olFo lderCalendar)

' 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

--
Eric Legault (Outlook MVP, MCDBA, MCTS: Messaging & Collaboration)
Try Picture Attachments Wizard for Outlook:
http://www.collaborativeinnovations.ca
Blog: http://blogs.officezealot.com/legault/


"rut" wrote:

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


Ads