![]() |
If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Search this Thread | Display Modes |
#1
|
|||
|
|||
![]()
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 |
#2
|
|||
|
|||
![]()
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 |
#3
|
|||
|
|||
![]()
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 |
#4
|
|||
|
|||
![]()
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 |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
import info from old calendar to new calendar | SPA_in_Ottawa | Outlook - Calandaring | 1 | June 14th 06 01:19 AM |
Sharing calendar info | Zalthu | Outlook - General Queries | 2 | June 2nd 06 11:25 AM |
I can't save info on my calendar in outlook. | Pasta guy | Outlook - Calandaring | 1 | March 28th 06 05:18 AM |
synchronizing contact info into the calendar | gina | Outlook - Calandaring | 3 | February 27th 06 03:27 PM |
calendar info lost | [email protected] | Outlook - General Queries | 0 | January 30th 06 06:55 AM |