如何定义pst(outlook)文件路径,以便我可以获取我的日历项目

时间:2011-07-05 10:38:56

标签: vb.net

我想从我的Outlook calander中回收我的calander项目:

    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
            End If
        Next
    Next

问题是Outlook互操作从我的psd自动完成。 说我想指出pst文件的路径...... 有人可以告诉我怎么样?

1 个答案:

答案 0 :(得分:0)

我猜你应该使用Microsoft.Office.Interop.Outlook中的_Store接口,它代表本地计算机上的文件或存储当前配置文件中帐户的电子邮件和其他项目的网络驱动器。< / p>

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

康拉德,我感觉至少在Outlook自动化领域,索引从一开始,因此这些循环也从一开始。