本文介绍了CDO:按日期查找所有约会...的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时删除!!

我现在正在尝试使用Access中的VBA代码在Exchange-Server上通过CDO查找约会。


Outlook视图控件没有给我带来成功所以远,所以我试过CDO


目标是找到某一特定用户的所有约会。


这是示例代码是根据我在互联网上找到的几个帖子写的。


正如你所看到的,我不会尝试通过其EntryID找到约会,EntryID存储在我的access-DB中应用程序

 
unction ExchangeTermineFinden()如 对象
Dim oMAPISession 作为 MAPI.Session
Dim oApp As MAPI .AppointmentItem
Dim TerminFolder As MAPI.Folder
Dim Termine As MAPI.Messages

Dim msgFilter As MAPI.MessageFilter

设置 oMAPISession = CreateObject(" MAPI.Session" )
如果 IsNull(oMAPISession)然后
Debug.Print " ;会话fehlgeschlagen"
退出 功能
结束 如果

' Exchange anmelen
oMAPISession.Logon "" ,"" ; , False , True ,0, True ," exchange" & vbLf& " nico"
设置 TerminFolder = oMAPISession.GetDefaultFolder(CdoDefaultFolderCalendar)

'终止成功

设置 Termine = TerminFolder.Messages

Set msgFilter = Termine.Filter

msgFilter.Fields.Add CdoPR_START_DATE," 04/01/2011"
msgFilter.Fields.Add CdoPR_END_DATE," 04/30 / 2011"
Termine.Sort CdoAscending,CdoPR_START_DATE

Set oApp = Termine.GetFirst
Debug .Print oApp.Subject
Termine.GetNext

while oApp<> Nothing
Debug.Print oApp.Subject
Termine.GetNext
Wend


结束 功能
解决方案

I am trying now for days to find appointments via CDO on a Exchange-Server using VBA-code in Access.

The Outlook view Control did not give me success so far, so I tried CDO

The goal is to find all appointments for a certain user on a given day.

This is the sample code which was written according to several postings I found somewhere in the Internet.

As you can see, I don't try to find appointments via its EntryID, which is stored in my access-DB for application

unction ExchangeTermineFinden() As Object
  Dim oMAPISession As MAPI.Session
  Dim oApp As MAPI.AppointmentItem
  Dim TerminFolder As MAPI.Folder
  Dim Termine As MAPI.Messages

  Dim msgFilter As MAPI.MessageFilter

  Set oMAPISession = CreateObject("MAPI.Session")
  If IsNull(oMAPISession) Then
    Debug.Print "Session fehlgeschlagen"
    Exit Function
  End If

  'An Exchange anmelen
  oMAPISession.Logon "", "", False, True, 0, True, "exchange" & vbLf & "nico"
  Set TerminFolder = oMAPISession.GetDefaultFolder(CdoDefaultFolderCalendar)

  'Termin suchen

  Set Termine = TerminFolder.Messages

  Set msgFilter = Termine.Filter

  msgFilter.Fields.Add CdoPR_START_DATE, "04/01/2011"
  msgFilter.Fields.Add CdoPR_END_DATE, "04/30/2011"
  Termine.Sort CdoAscending, CdoPR_START_DATE

  Set oApp = Termine.GetFirst
  Debug.Print oApp.Subject
  Termine.GetNext

  While oApp <> Nothing
    Debug.Print oApp.Subject
    Termine.GetNext
  Wend


End Function
解决方案


这篇关于CDO:按日期查找所有约会...的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

1403页,肝出来的..

09-07 23:41