PDA

View Full Version : Get groupwise appointments



musicmaker
02-19-2008, 03:31 AM
Hello,

I'm trying to retrieve appointments for a specific date (today) from groupwise.

This is my code till now:

Option Compare Database
Option Explicit
Private ogwApp As GroupwareTypeLibrary.Application
Private ogwRootAcct As GroupwareTypeLibrary.Account

Sub ReadGroupwiseAppointments()
' declaration
Dim sNow As String
Dim sLoginname As String
Dim sFolderToSearch As String
Dim ogwMail As Object
Dim sCommandOptions As String
Dim sStartDate As String
Dim sDiff As Integer

sNow = Format(Date, "dd-mm-yyyy")
sLoginname = "xxxx"
sFolderToSearch = "Agenda"

' set application object reference
If ogwApp Is Nothing Then
Set ogwApp = CreateObject("NovellGroupWareSession")
End If

Set ogwRootAcct = ogwApp.Login(sLoginname, sCommandOptions, _
, egwPromptIfNeeded)

' loop through the agenda
For Each ogwMail In ogwRootAcct.AllFolders.ItemByName(sFolderToSearch).Messages
With ogwMail
' startdate
sStartDate = Format(.StartDate, "dd-mm-yyyy")

' datediff
sDiff = DateDiff("d", sStartDate, sNow)

' if appointment is for today then show it
If sDiff = 0 Then
Debug.Print .StartDate & " - " & .Subject
End If
End With
Next ogwMail

' release objects
Set ogwRootAcct = Nothing
Set ogwApp = Nothing
End Sub

There are still some problems I have:
* the script loops through all the appointment so it's very slow. Is there a way to select a date before looping through the agenda?
* I can only get appointments from my own account. If I fill in another username after sLoginName I still get appointments from my own agenda.
* I can't get the "end time" of an appointment. I've tryed "stoptime" and "endtime".

I hope someone can help me.
Regards and thank you very much in advance!!!!