none
Problem getting EntryID of shared calendars by different methods RRS feed

  • Question

  • When a user changes calendars my app needs to check whether the user is licenced to perform certain actions on that calendar.

     

    To support this requirement the app builds a dataset of details of the calendar folders available by iterating through the folders shown in the calendar navigation pane.  If a folder does not have a FolderPath property starting with \\ it is assumed to be a shared folder. The DisplayName is used to resolve the Recipient and the resulting email address is used in a call to GetSharedDefaultFolder  The email address, EntryID, StoreID and DisplayName are stored in the dataset and the licence permissions associated with the email address are retrieved and stored.

     

    This info can successfully be used to programmatically select the right calendar folder and create entries in it.

     

    The problem arises when I click on a shared folder in the calendar view and trigger the ExplorerFolderSwitch event. If I use that event to get the CurrentFolder of the ActiveExplorer and get the properties for that they do not match the properties of the folder that I got from GetSharedDefaultFolder. That returns a completely different EntryID and instead of having a length of 92 it has a length of 582  ! In both case the FolderPath is the same as the EntryID. I presume this is a quirk of shared calendars.

     

    To summarise the folder object accessed through the Navigation pane and the one accessed through the ExplorerFolderSwitch event give completely different EntryIDs even though it is the same folder.

     

    I have double checked that I am dealing with the same calendar by programmatically creating appointments in a shared calendar then in Calendar view click away and back and trapping the ExplorerFolderSwitch event when I click back to the shared calendar with the new appointments in.

     

    I am using VS2015 with Office365 and Outlook 2016. My code is based on the PIA for Outlook 2007.

     

    I am sure this code worked about a year ago but now it has this problem. 

     

    Any thoughts?


    Mike VE

    Friday, November 3, 2017 3:19 PM

Answers

  • One thing to keep in mind is that Outlook caches shared folders in the primary mailbox's OST file outside of the visible IPM tree (you can see it in OutlookSpy if you click IMsgStore and open the "Shared Data" folder). And GetSharedDefaulsFolder would be retuning the actual live folder from the other mailbox.

    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.5 is now available!

    • Marked as answer by Mike VE Tuesday, November 7, 2017 8:59 AM
    Friday, November 3, 2017 5:15 PM
  • Hi Mike,

    I could get the same result, and I am afraid we could not get the EntryID from FolderSwitch.

    For a workaround, I suggest you check whether myExplorer.Caption return the current SharedCalendar Name.

    Best Regards,

    Edward


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    • Marked as answer by Mike VE Monday, November 13, 2017 9:30 AM
    Tuesday, November 7, 2017 9:25 AM
  • Unfortunately, it didn't work out. The Explorer's Caption property doesn't get updated until after the ExplorerFolderSwitch event.

    Mike VE

    • Marked as answer by Mike VE Wednesday, November 15, 2017 4:29 PM
    Monday, November 13, 2017 3:43 PM

All replies

  • You should never directly compare entry ids - different entry ids can refer to the same object. Use Namespace.CompareEntryIds instead.

    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.5 is now available!

    Friday, November 3, 2017 3:28 PM
  • Thanks for the reply Dmitry

    I tried that but it gave false when comparing the two IDs that I know came from the same folder.


    Mike VE

    Friday, November 3, 2017 4:37 PM
  • One thing to keep in mind is that Outlook caches shared folders in the primary mailbox's OST file outside of the visible IPM tree (you can see it in OutlookSpy if you click IMsgStore and open the "Shared Data" folder). And GetSharedDefaulsFolder would be retuning the actual live folder from the other mailbox.

    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.5 is now available!

    • Marked as answer by Mike VE Tuesday, November 7, 2017 8:59 AM
    Friday, November 3, 2017 5:15 PM
  • I've had a look with Outlook Spy and I see what you mean. It looks as though there is no way to use the ExplorerFolderSwitch event to link to my licence data because I can't get the underlying EntryID (uncached) or the DisplayName. Do you think that is right?

     

    Mike VE

    Saturday, November 4, 2017 11:48 AM
  • Hi Mike,

    I could get the same result, and I am afraid we could not get the EntryID from FolderSwitch.

    For a workaround, I suggest you check whether myExplorer.Caption return the current SharedCalendar Name.

    Best Regards,

    Edward


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    • Marked as answer by Mike VE Monday, November 13, 2017 9:30 AM
    Tuesday, November 7, 2017 9:25 AM
  • Sorry I'm so late in replying. That's a great idea. Yes I can get the caption so it should be possible to strip out the bits I don't want and work from there. I'll definitely give that a try.

    Mike VE

    Monday, November 13, 2017 9:30 AM
  • Unfortunately, it didn't work out. The Explorer's Caption property doesn't get updated until after the ExplorerFolderSwitch event.

    Mike VE

    • Marked as answer by Mike VE Wednesday, November 15, 2017 4:29 PM
    Monday, November 13, 2017 3:43 PM