Outlook Selecting a Subfolder in the SharedMailbox using GetSharedDefaultFolder

前端 未结 2 535
执念已碎
执念已碎 2021-01-14 20:24

I am having trouble trying to select a subfolder in SharedMailbox.
I have read a number of resources on GetSharedDefaultFolder.
However

2条回答
  •  无人及你
    2021-01-14 21:15

    The GetSharedDefaultFolder method of the Namespace class accepts two parameters: a Recipient object and the FolderType value.

    The How to: Display a Shared Calendar of a Recipient article provides the following sample code in C#:

    private void DisplayManagerCalendar()
    {
        Outlook.AddressEntry addrEntry =
             Application.Session.CurrentUser.AddressEntry;
        if (addrEntry.Type == "EX")
        {
            Outlook.ExchangeUser manager =
            Application.Session.CurrentUser.
                AddressEntry.GetExchangeUser().GetExchangeUserManager();
            if (manager != null)
            {
                Outlook.Recipient recip =
                    Application.Session.CreateRecipient(manager.Name);
                if (recip.Resolve())
                {
                    try
                    {
                        Outlook.Folder folder =
                           Application.Session.GetSharedDefaultFolder(
                              recip, Outlook.OlDefaultFolders.olFolderCalendar)
                           as Outlook.Folder;
                        folder.Display();
                    }
                    catch
                    {
                        MessageBox.Show("Could not open manager's calendar.",
                           "GetSharedDefaultFolder Example",
                           MessageBoxButtons.OK,
                           MessageBoxIcon.Error);
                    }
                }
            }
        }
    }
    

提交回复
热议问题