cancel
Showing results for 
Search instead for 
Did you mean: 

Outlook read external calender

Former Member
0 Kudos

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

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

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

Former Member
0 Kudos

Hi Bernhard

Pls. give me the function from


of_GetFolderPath( lole_Folder )

what do you mean about this:

Get the corresponding folder for further processing:

lole_AppItemFolder = lole_MAPI.GetFolderFromId( this.is_CalendarIds[li_Kalender] )

André Rust

Former Member
0 Kudos

Hi,

I'm not firm to VB, sorry.

Pls. give me the PB code. Thx.

André Rust

Former Member
0 Kudos

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

Former Member
0 Kudos

Sorry André,

this is PowerScript!

Bernhard

Former Member
0 Kudos

Hi Bernhard,

this works. I get all folder. Thanks.

André Rust

Former Member
0 Kudos

Hi André,

please mark this topic 'answered'.

Bernhard

Former Member
0 Kudos

Hi Bernhard,

Done

André Rust

Former Member
0 Kudos

Hi Bernhard,

is this.ici_olfolder = Constant Integer olPublicFoldersAllPublicFolders = 18?

or what is this.

André Rust

Former Member
0 Kudos

Hi André,

yes.

BTW:

You can use to the developer tools in Outlook (Visual Basic, object catalog, then select Outlook and search for the desired constant or property) to get more details.

Regards

Bernhard

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi André,

if it is a shared folder you can use the Namespace.GetSharedDefaultFolder methode.

see VBA, Outlook, Seeing &amp;#39;People&amp;#39;s Calendars - Stack Overflow