![]() |
Need help scraping calendar info
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 |
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 |
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 |
Need help scraping calendar info
I am new to vba in outlook but I think he meant
' Get namespace and ***Calendar*** folder reference. ' Get the first ***appointment*** from the ***Calendar*** folder. It's a great start though to explain the object model and you should give a whirl "rut" wrote in message oups.com... 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 |
All times are GMT +1. The time now is 03:53 PM. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2006 OutlookBanter.com