on 06-30-2015 9:03 AM
Hi all,
I have in my Outlook my own calendar. This works with my own calendar. But is not suitable for a system with multiple users to set appointments.
In addition I have is yet another calendar with us to Intranet. How can I address the Intranet Calendar to create appointments from there PB?
Need help. Thanks a lot.
André Rust
Hi André,
I use this code for that:
constant integer ici_olFolderCalendar = 9
constant string ics_MessageClassAppointment = "IPM.Appointment"
// Connect to Outlook
this.iole_Outlook = create OleObject
this.iole_Outlook.ConnectToNewObject( "Outlook.Application" )
lole_MAPI = this.iole_Outlook.GetNameSpace( "MAPI" )
// Current users calendar:
lole_Folder = lole_MAPI.GetDefaultFolder( this.ici_olFolderCalendar )
this.is_PersonalCalendarPath = this.of_GetFolderPath( lole_Folder )
// Get all other calendars:
this.of_ScanFolders( lole_MAPI )
this function fills both:
this.is_CalendarPaths[] = ls_FolderPath
this.is_CalendarIds[] = lole_Folder.EntryId
// Function to get all other calendars:
of_ScanFolders( readonly ole_Object aole_Folder 😞
long ll_NumFolders
OleObject lole_Folders, lole_Folder
string ls_FolderName, ls_FolderPath
lole_Folders = aole_Folder.Folders
lole_Folder = lole_Folders.GetFirst()
do while IsValid( lole_Folder )
if lole_Folder.DefaultMessageClass = this.ics_MessageClassAppointment then
// Calendar found
ls_FolderName = lole_Folder.Name
ls_FolderPath = this.of_GetFolderPath( lole_Folder )
if ls_FolderPath = this.is_PersonalCalendarPath then
// this is my calendar
else
// another calendar
ll_NumFolders = UpperBound( this.is_CalendarPaths[] )
this.is_CalendarPaths[ll_NumFolders + 1] = ls_FolderPath
this.is_CalendarIds[ll_NumFolders + 1] = lole_Folder.EntryId
end if
end if
this.of_ScanFolders( lole_Folder )
lole_Folder = lole_Folders.GetNext()
loop
Get the corresponding folder for further processing:
lole_AppItemFolder = lole_MAPI.GetFolderFromId( this.is_CalendarIds[li_Kalender] )
HTH,
Bernhard
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi André,
of_GetFolderPath( readonly OleObject aole_Folder 😞
OleObject lole_Folder
string ls_FolderPath
if this.ii_OutlookVersion <= 9 then
// Property "FolderPath" does not exists, determine it
ls_FolderPath = "\" + string( aole_Folder.Name )
lole_Folder = aole_Folder.Parent
do while lole_Folder.Class = this.ici_olFolder
ls_FolderPath = "\" + string( lole_Folder.Name ) + ls_FolderPath
lole_Folder = lole_Folder.Parent
loop
ls_FolderPath = "\" + ls_FolderPath
else
// Property "FolderPath" exists in Outlook version 10 and later
ls_FolderPath = string( aole_Folder.FolderPath )
end if
return ls_FolderPath
lole_AppItemFolder is the oleobject witch contains the appointments of calendar[li_Kalender]. You need it for editing appointments (if you want to).
Bernhard
Hi André,
if it is a shared folder you can use the Namespace.GetSharedDefaultFolder methode.
see VBA, Outlook, Seeing &#39;People&#39;s Calendars - Stack Overflow
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.