none
Adding a delegated/shared folder to NavigationPane RRS feed

  • Question

  • Hello i have the following code in a COM AddIn project (vb.net for outlook 2010)

    I want to add a shared conactlist to a new Navigation group.

    But i get a "System.AccessViolationExecption" when executing "oFolders.Add(oFolder).

    Is there any help out there?

    With kind regards 

    Markus Bantel

        Dim sFolderID As String
            sFolderID = "00000000CB9306EE42053349AF91117EBE4F06370100EF98F929A20FA541BF48ACB56FA99D1800A3783600900000"
            Dim sStoreID As String
            sStoreID = "0000000038A1BB1005E5101AA1BB08002B2A56C20000454D534D44422E444C4C00000000000000001B55FA20AA6611CD9BC800AA002FC45A0C0000006F75746C6F6F6B2E6873732E6C6F63616C002F6F3D4853532F6F753D45786368616E67652041646D696E6973747261746976652047726F7570202846594449424F484632335350444C54292F636E3D526563697069656E74732F636E3D617300"
    
            Dim oModule As NavigationModule ' Get the Contactmodule
            oModule = Application.ActiveExplorer.NavigationPane.Modules.GetNavigationModule(OlNavigationModuleType.olModuleContacts)
            Dim oGroups As NavigationGroups ' The groups in contactmodule
            oGroups = oModule.NavigationGroups
            Dim oFolders As NavigationFolders
            Dim oGroup As NavigationGroup
            oGroup = oGroups.Item("Testgroup") ' get group
            If oGroup Is Nothing Then
            oGroup = oGroups.Create("Testgroup") ' or else add new one
            End If
            oFolders = oGroup.NavigationFolders '
          
            Dim oNamespace As Outlook.NameSpace
            oNamespace = Application.GetNamespace("MAPI")
    
            Dim oFolder As Outlook.MAPIFolder
            ' get the shared folder from another user, i have full rights
            oFolder = oNamespace.GetFolderFromID(sFolderID, sStoreID)
            Try
                oFolders.Add(oFolder) ' <--- here is the problem
            Catch ex As System.Exception
    
            End Try
    

     

     




    Friday, January 27, 2012 10:11 AM

Answers

  • It's simply a "feature" of Outlook when used with Exchange.  Default folders for Exchange Mailboxes are allowed to be delegated, and Outlook was designed to display any delegated folders you have access to.  Having full permissions for loading an entire Mailbox is a different beast, and is treated as a completely separate store (much like having a second Exchange account but slightly different).


    Eric Legault
    MVP (Outlook)
    About me...
    Monday, January 30, 2012 6:12 PM
    Moderator

All replies

  • If that folder is in another user's Mailbox (a shared folder), then you should use GetSharedDefaultFolder to obtain a reference to it, not GetFolderFromID.  Try that and see if it works.

    There's tons of stuff in this thread as well on working with the Navigation pane:

    http://social.msdn.microsoft.com/Forums/en-US/outlookdev/thread/0d20e75d-81f2-4ede-9090-c51b9f9a0ce9


    Eric Legault
    MVP (Outlook)
    About me...
    Friday, January 27, 2012 4:00 PM
    Moderator
  • Hi Eric, with the GetSharedDefaultFolder it works. But it's another contact folder that he created and shared it to me. I took the email and took the storeid and folderid from the email. 

    Here is the invitation xml file:

    <pre lang="x-xml"><?xml version="1.0"?>
      <SharingMessage xmlns="http://schemas.microsoft.com/sharing/2008">
      <DataType>contacts</DataType>
      <Initiator>
        <Name>xxx</Name>
        <SmtpAddress>xxx@h-s.de</SmtpAddress> 
        <EntryId>00000000DCA740C8C042101AB4B908002B2FE18201000000000000002F6F3D4853532F6F753D45786368616E67652041646D696E6973747261746976652047726F7570202846594449424F484632335350444C54292F636E3D526563697069656E74732F636E3D617300</EntryId>
      </Initiator>
      <Invitation>
        <Title>Test</Title> 
        <Providers> 
          <Provider TargetRecipients="Markus.Bantel@h-s.de" Type="ms-exchange-internal"> 
            <FolderId xmlns="http://schemas.microsoft.com/exchange/sharing/2008">00000000CB9306EE42053349AF91117EBE4F06370100EF98F929A20FA541BF48ACB56FA99D1800A3783600900000</FolderId>   
            <MailboxId xmlns="http://schemas.microsoft.com/exchange/sharing/2008">0000000038A1BB1005E5101AA1BB08002B2A56C20000454D534D44422E444C4C00000000000000001B55FA20AA6611CD9BC800AA002FC45A0C0000006F75746C6F6F6B2E6873732E6C6F63616C002F6F3D4853532F6F753D45786368616E67652041646D696E6973747261746976652047726F7570202846594449424F484632335350444C54292F636E3D526563697069656E74732F636E3D617300</MailboxId> 
          </Provider> 
        </Providers> 
      </Invitation>
    </SharingMessage>
    

    Friday, January 27, 2012 4:35 PM
  • Is his entire Mailbox loaded in your profile?  I believe that's required to access non-default folders in delegated Mailboxes.
    Eric Legault
    MVP (Outlook)
    About me...
    Friday, January 27, 2012 4:37 PM
    Moderator
  • Acually it is not. But if accept the invitation in the email, the contact folder is added but the store is not.

    Tried to add the store to the profile but failed. So what should i do to add the mailbox to the profile?

    With kind regards Markus

    Friday, January 27, 2012 4:41 PM
  • Go into Account Settings and open the settings dialog for your Mailbox; on the Advanced tab, click Add to add his Mailbox.  It'll fail if you don't have the rights; your code would fail as well if you don't.
    Eric Legault
    MVP (Outlook)
    About me...
    Friday, January 27, 2012 4:44 PM
    Moderator
  • Ok, i could add the Mailbox as an additional mailbox. Running the code worked. But after removing the mailbox again, the folder vanished.

    When i use the invitation from the email the mailbox is not added (or perhaps hidden added ?).

    How can i temporarly add the store in vb.net? Tried the following code but did not work

            Dim oStore As Outlook.Store
            oStore = oNamespace.GetStoreFromID(sStoreID)
            oNamespace.AddStore(oStore)
    

    Error: Object not found.

    But the StoreId is correct, i used it in GetFolderFromId.

    Lot's of ??????

    Friday, January 27, 2012 5:02 PM
  • You can't add additional Exchange Mailboxes to your default Mailbox with the Outlook Object Model; nor can you add an additional Exchange account (and relevant store).  You would have to use Profman: http://www.dimastr.com/redemption/profiles.htm.  Or use the Office Resource Kit to deploy Outlook profiles with the desired account configuration.  I'm not sure if you can update profiles using this approach though.


    Eric Legault
    MVP (Outlook)
    About me...
    Friday, January 27, 2012 5:44 PM
    Moderator
  • Ok, i tried it with the redemption component. I could add a mailbox and then add the folder to the navigation pane. But if i remove the mailbox the folder vanished as well.

    I ask myself how does outlook manage it to have the shared folder without have the mailbox in the profile?

    Any guesses?

     


    Monday, January 30, 2012 3:12 PM
  • It's simply a "feature" of Outlook when used with Exchange.  Default folders for Exchange Mailboxes are allowed to be delegated, and Outlook was designed to display any delegated folders you have access to.  Having full permissions for loading an entire Mailbox is a different beast, and is treated as a completely separate store (much like having a second Exchange account but slightly different).


    Eric Legault
    MVP (Outlook)
    About me...
    Monday, January 30, 2012 6:12 PM
    Moderator