View Single Post
  #3  
Old July 5th 06, 11:42 AM posted to microsoft.public.outlook.program_vba
rut
external usenet poster
 
Posts: 2
Default Need help scraping calendar info

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


Eric wrote:
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