开发者

How to define a pst(outlook) file path so that i can get my calendar item

开发者 https://www.devze.com 2023-03-17 21:35 出处:网络
I mange to retrive my calander items from my outlook calander like that: Dim objOLApp As Outlook.Application

I mange to retrive my calander items from my outlook calander like that:

    Dim objOLApp As Outlook.Application
    Dim objFolder As Outlook.MAPIFolder
    Dim objExplorer As Outlook.Explorer
    Dim objSubFolder As Outlook.MAPIFolder
    Dim objCalenderItem As Outlook.AppointmentItem
    Dim objOutlookFolders As Outlook.Folders
    Dim intFolderCtr As Integer
    Dim intSubFolderCtr As Integer
    Dim intAppointmentCtr As Integer

    objOLApp = New Outlook.Application
    objOutlookFolders = objOLApp.Session.Folders

    For intFolderCtr = 1 To objOutlookFolders.Count
        objFolder = objOutlookFolders.Item(intFolderCtr)
        objExplorer = objFolder.GetExplorer()
        For intSubFolderCtr = 1 To objExplorer.CurrentFolder.Folders.Count
            objSubFolder = objExplorer.CurrentFolder.Folders.Item(intSubFolderCtr)
            If objSubFolder.DefaultItemType = Outlook.OlItemType.olAppointmentItem Then
                For intAppointmentCtr = 1 To objSubFolder.Items.Count
                    objCalenderItem = objSubFolder.Items.Item(intAppointmentCtr)
                    Call Debug.Print(objCalenderItem.Subject & ", " & objCalenderItem.Location)

                Next
            E开发者_StackOverflow社区nd If
        Next
    Next

The problem is outlook interope does that automaticly from my psd. Say i want to point out the path of the pst file... Can someone please tell me how?


I guess you should use the _Store interface in the Microsoft.Office.Interop.Outlook which represents a file on the local computer or a network drive that stores e-mail messages and other items for an account in the current profile.

http://msdn.microsoft.com/en-us/library/microsoft.office.interop.outlook.store.aspx

And Konrad, I have a feeling that in at least the Outlook automation world the indexes start at one, hence those loops start at one too.

0

精彩评论

暂无评论...
验证码 换一张
取 消