none
GetSharedDefaultFolder with Outlook newer than 2003 RRS feed

  • Question

  • Hi,

    I'm using the below code to open the shared calendar of another user (simplified for readability):

    GetCalendarByMail (Outlook::_NameSpace spSession_, BSTR bstrMail_, Outlook::MAPIFolder &rspCalendar_)
    {
      Outlook::Recipient spRecipient;
      spSession_->CreateRecipient(bstrMail_, &spRecipient);
      VARIANT_BOOL vbResolved = VARIANT_FALSE;
      spRecipient->Resolve(&vbResolved);
      if (vbResolved == VARIANT_TRUE)
      {
        spSession_->GetSharedDefaultFolder(spRecipient, Outlook::olFolderCalendar, &rspCalendar_);
      }
    }

    It works fine with Outlook 2003. But when used with Outlook 2007 or 2010 GetSharedDefaultFolder will always return 0x8004011D. Even if I use the code to open my own calendar.

    Any help is appreciated.

    Friday, November 9, 2012 4:12 PM

Answers

All replies

  • Can you open that folder through the Outlook UI (File | Open | Other User's Folder)?


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

    Friday, November 9, 2012 4:51 PM
  • Yes, I can. I cannot even open my own calendar this way and of course I am able to open my own calendar through the UI.
    Monday, November 12, 2012 7:18 AM
  • Where does your code run? Is it COM add-in or a standalone exe?

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

    Monday, November 12, 2012 5:08 PM
  • It's a COM add-in
    Tuesday, November 13, 2012 7:14 AM
  • Is behavior the same if you create a new profile that points to the same mailbox?


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

    Tuesday, November 13, 2012 2:17 PM
  • Ok, this is very strange.

    When I delete the existing profile and create a new one to the same mailbox it works fine. But when I restart Outlook it will show the same behavior as before.

    It will only work during the first session of a new profile. Does that make any sense to you?

    Wednesday, November 14, 2012 9:45 AM
  • Is "Download shared folders" checkbox checked in "More Settings | Advanced"  of the Exchange account?


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

    Thursday, November 15, 2012 4:46 PM
  • The checkbox was checked. Unchecking it did not solve the problem.

    On the Outlook 2003 machine (where it works) there is no such checkbox.

    Thank you very much for your continued efforts.

    Friday, November 16, 2012 7:44 AM
  • How about turning off the cached mode?

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

    • Marked as answer by 2258654 Tuesday, November 20, 2012 7:30 AM
    Tuesday, November 20, 2012 6:04 AM
  • Yes! That helped! Thank you very much for your help.

    While I'm already quite happy with that answer I still have a follow-up:

    Do you think there is a way to make this work without having to disable the cached mode? There might be some users who don't want to turn it off.

    Thanks again

    Tuesday, November 20, 2012 7:34 AM
  • I do not know. The only way to know for sure is to open a support case with MS and let them try to figure out what exactly went wrong.


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

    Tuesday, November 20, 2012 1:56 PM