none
Problem with shared calendar RRS feed

  • Question

  • I have an Outlook add-in that is concerned with managing calendars. It compiles a list of calendars available to the user. To find the shared calendars available it scans the NavigationPane for NavigationFolders in the "Shared Folders" NavigationGroup. This works fine.

     

    The problem comes when the add-in tries to select a shared folder in code.  

    I have a MAPIFolder obeject called oFolder. I want to set this to the shared folder. I use the line

    oFolder = oNS.GetSharedDefaultFolder(oRecipient,OlDefaultFolders.olFolderCalendar); (having resolved the Recipient using the DisplayName read from the NavigationPane)

    This works fine but it has an unfortunate side-effect. The original DisplayName read from the NavigationPane was "Wayne Slouch". Calling the line above adds a second entry to the NavigationPane - "Calendar - Wayne Slouch".

    Is there a better way I can 

    a) get a list of the calendar folders available (other than those in the user's own mailbox?

    b) set my MAPIFolder object to point at the shared folder without creating an extra entry in the NavigationPane?

    Thanks


    Mike VE

    Thursday, February 19, 2015 9:57 AM

Answers

  • Hello Mike,

    If the folder is already presented in the Navigation pane you can try iterating over all folders to find it. The Stores property of the Namespace class returns a Stores collection object that represents all the Store objects in the current profile. The Folders property of the Folder class returns the Folders collection that represents all the folders contained in the specified Folder. 

    Also you may consider using the OpenSharedFolder method of the Namespace class.

    There is no other way to get the shared folder in Outlook.


    Thursday, February 19, 2015 12:35 PM
  • When you iterate the NavigationFolders collection get the Folder object for each NavigationFolder and cache whatever information you want for that folder, such as StoreID, EntryID, FolderPath, etc. You can then retrieve the folder later if needed from the cached information. The OpenSharedFolder method suggested by Eugene takes a FolderPath argument.

    Ken Slovak MVP - Outlook

    Wednesday, February 25, 2015 9:28 PM
    Moderator

All replies

  • Hello Mike,

    If the folder is already presented in the Navigation pane you can try iterating over all folders to find it. The Stores property of the Namespace class returns a Stores collection object that represents all the Store objects in the current profile. The Folders property of the Folder class returns the Folders collection that represents all the folders contained in the specified Folder. 

    Also you may consider using the OpenSharedFolder method of the Namespace class.

    There is no other way to get the shared folder in Outlook.


    Thursday, February 19, 2015 12:35 PM
  • When you iterate the NavigationFolders collection get the Folder object for each NavigationFolder and cache whatever information you want for that folder, such as StoreID, EntryID, FolderPath, etc. You can then retrieve the folder later if needed from the cached information. The OpenSharedFolder method suggested by Eugene takes a FolderPath argument.

    Ken Slovak MVP - Outlook

    Wednesday, February 25, 2015 9:28 PM
    Moderator
  • Thanks for the responses, guys. Sorry I am late in replying.

    I was already integrating over the navigation panes and this works well but does not return any shared folders.

    I have now done a lot of work on the code in two different environments. On OL2007 with on prem Exchange I can get the shared calendar DisplayName from the NavigationFolder and then using that to create a recipient object from the Namespace and then resolving it. With the resolved recipient I can call the Namespace's GetSharedDefaultFolder. With the MapiFolder object returned I can get the info I need (EntryID, StoreID, etc). I cannot use the OpenSharedFolder method because I do not have any of the possible parameters, only the DisplayName.

    The strange behaviour only seems to occur in my other environment - OL2013 with an Office365 account. Here I accept an invitation to share a calendar and a new entry is created in the Navigation Pane. In my case it was "Wayne Slouch". When the code described above is run at the moment when the new Recipient object is resolved a new entry appears in the Navigation Pane appears called "Calendar - Wayne Slouch".

    The only work-around I can come up with is to scan the Navigation Pane again and delete the offending entry but that seems very clumsy.

    Any ideas?


    Mike VE

    Tuesday, March 3, 2015 3:05 PM
  • What code are you using? Are you iterating the NavigationFolders collection and getting the folder for each and reading the FolderPath?

    Ken Slovak MVP - Outlook

    Tuesday, March 3, 2015 3:11 PM
    Moderator
  • I am struggling with your point b) too

    Did you manage to resolve it other than scanning the navigation pane and removing the just created "Calendar - Wayne Slouch" if "Wayne Slouch" already existed ?

    Thursday, October 17, 2019 11:01 AM
  • Hi. I did not find a code cure but I found out more about the problem. If a message in the special folder was recently edited then it remains available in the folder on my machine. If it has not been recently edited then it behaves as though it is not on my machine. I did not investigate exactly how long this period is. My sub folder was for certain standard messages. I found that if I did a small edit to all the ones I wanted to use in the foreseeable future they became available to my code again.

    I hope that helps.


    Mike VE

    Friday, October 18, 2019 1:37 PM