none
getting inbox folder RRS feed

  • Question

  • hi,

    just wanted to know the different between:

    Application outlookApp = new Microsoft.Office.Interop.Outlook.Application();
    NameSpace mapiNamespace = outlookApp.GetNamespace("MAPI");
    MAPIFolder inboxFolder = mapiNamespace.GetDefaultFolder(OlDefaultFolders.olFolderInbox);

    and:

    outlookApp = new Microsoft.Office.Interop.Outlook.Application();

    Application outlookApp = new Microsoft.Office.Interop.Outlook.Application();
    MAPIFolder inboxFolder = outlookApp.Session.Folders[bla@bla.com].Store.GetDefaultFolder(OlDefaultFolders.olFolderInbox);

    (bla@bla.com is an account in outlook)

    tnx, shiran.


    • Edited by redgolda Tuesday, October 9, 2012 8:42 AM
    Tuesday, October 9, 2012 8:42 AM

Answers

  • The default store is the Store where your default account delivers emails. You can access the Inbox for the default store by using NameSpace.GetDefaultFolder(olFolderInbox).
     
    If you iterate the Accounts collection (NameSpace.Accounts), each Account object has a DeliveryStore property that returns the Store object where emails for that account are delivered. To get the Inbox for that store you'd use Store.GetDefaultFolder().

    --
    Ken Slovak
    [MVP-Outlook]
    http://www.slovaktech.com
    Author: Professional Programming Outlook 2007
    "redgolda" <=?utf-8?B?cmVkZ29sZGE=?=> wrote in message news:a6d53e32-a73c-4ea6-8508-80ad3fe14f87...

    what is the default store?

    how can I excess a specific mail account from all the acounts in the outlook with the first example?


    tnx, shiran

    Ken Slovak MVP - Outlook
    Wednesday, October 10, 2012 2:35 PM
    Moderator

All replies

  • The second example will return the default Inbox for whatever Store the Folder named bla@bla.com belongs to. The first example returns the Inbox for the default Store.

    --
    Ken Slovak
    [MVP-Outlook]
    http://www.slovaktech.com
    Author: Professional Programming Outlook 2007
    "redgolda" <=?utf-8?B?cmVkZ29sZGE=?=> wrote in message news:7a7ad633-5690-47ce-ace0-065455876332...

    hi,

    just wanted to know the different between:

    Application outlookApp = new Microsoft.Office.Interop.Outlook.Application();
    NameSpace mapiNamespace = outlookApp.GetNamespace("MAPI");
    MAPIFolder inboxFolder = mapiNamespace.GetDefaultFolder(OlDefaultFolders.olFolderInbox);

    and:

    outlookApp = new Microsoft.Office.Interop.Outlook.Application();

    Application outlookApp = new Microsoft.Office.Interop.Outlook.Application();
    MAPIFolder inboxFolder = outlookApp.Session.Folders[bla@bla.com].Store.GetDefaultFolder(OlDefaultFolders.olFolderInbox);

    (bla@bla.com is an account in outlook)

    tnx, shiran.



    Ken Slovak MVP - Outlook
    Tuesday, October 9, 2012 6:19 PM
    Moderator
  • what is the default store?

    how can I excess a specific mail account from all the acounts in the outlook with the first example?


    tnx, shiran
    • Edited by redgolda Wednesday, October 10, 2012 5:58 AM
    Wednesday, October 10, 2012 5:57 AM
  • The default store is the Store where your default account delivers emails. You can access the Inbox for the default store by using NameSpace.GetDefaultFolder(olFolderInbox).
     
    If you iterate the Accounts collection (NameSpace.Accounts), each Account object has a DeliveryStore property that returns the Store object where emails for that account are delivered. To get the Inbox for that store you'd use Store.GetDefaultFolder().

    --
    Ken Slovak
    [MVP-Outlook]
    http://www.slovaktech.com
    Author: Professional Programming Outlook 2007
    "redgolda" <=?utf-8?B?cmVkZ29sZGE=?=> wrote in message news:a6d53e32-a73c-4ea6-8508-80ad3fe14f87...

    what is the default store?

    how can I excess a specific mail account from all the acounts in the outlook with the first example?


    tnx, shiran

    Ken Slovak MVP - Outlook
    Wednesday, October 10, 2012 2:35 PM
    Moderator