Missing member in Folders Object in Outlook NameSpace

Answered Missing member in Folders Object in Outlook NameSpace

  • Thursday, September 13, 2012 10:44 AM
     
      Has Code

    Hello,

    I'm trying to read items from a public folder. And below is the code I was trying to use (as found on msdn)

    Outlook.Application outlookApp = new Outlook.Application(); Outlook.NameSpace outlookNameSpace = outlookApp.GetNamespace("MAPI");

    Outlook.Folders folders = outlookNameSpace.Folders;
    Outlook.MAPIFolder publicFolder = folder.Item("Public Folders")

    However intellisence doesn't recognize the 'Item' member of the 'Folders' Object and if i Type it anyway it gives an error. It's as if my object model is incomplete. I haven't found any reference to this problem anywhere online...

    Here's a screenshot of what I see.

    Any help or ideas would be greatly appreciated.

    Best regards,
    Dries

All Replies

  • Thursday, September 13, 2012 2:44 PM
    Moderator
     
     Answered
    In C# that would be folder["Public Folders"].
     
    A better way to get a public folders reference would be to use NameSpace.GetDefaultFolder(OlDefaultFolders.olPublicFoldersAllPublicFolders). That will return a folder reference to All Public Folders.

    --
    Ken Slovak
    [MVP-Outlook]
    http://www.slovaktech.com
    Author: Professional Programming Outlook 2007
    "DriesDB" <=?utf-8?B?RHJpZXNEQg==?=> wrote in message news:db217859-307f-4144-99ef-7edc3ba25d3b...

    Hello,

    I'm trying to read items from a public folder. And below is the code I was trying to use (as found on msdn)

    Outlook.Application outlookApp = new Outlook.Application(); Outlook.NameSpace outlookNameSpace = outlookApp.GetNamespace("MAPI");

    Outlook.Folders folders = outlookNameSpace.Folders;
    Outlook.MAPIFolder publicFolder = folder.Item("Public Folders")

    However intellisence doesn't recognize the 'Item' member of the 'Folders' Object and if i Type it anyway it gives an error. It's as if my object model is incomplete. I haven't found any reference to this problem anywhere online...

    Here's a screenshot of what I see.

    Any help or ideas would be greatly appreciated.

    Best regards,
    Dries


    Ken Slovak MVP - Outlook
  • Friday, September 21, 2012 7:46 AM
     
     

    Dear Ken,

    Thank you so much, that did the trick. And I used your second recommendation as well.

    I don't know if you have any influence over it, but maybe the difference in syntax for c# should be more clearly marked on the relevant msdn pages?

    Thanks again,

    Best regards,

    Dries

  • Friday, September 21, 2012 2:46 PM
    Moderator
     
     
    Sorry, I don't have any contacts at dev division's content group, only with the Outlook content group. If the article allows commenting make a comment there about the need for more clarity about language specific syntax.

    --
    Ken Slovak
    [MVP-Outlook]
    http://www.slovaktech.com
    Author: Professional Programming Outlook 2007
    "DriesDB" <=?utf-8?B?RHJpZXNEQg==?=> wrote in message news:dd4360e4-24e9-42f3-894e-ef7734c2aa9e...

    Dear Ken,

    Thank you so much, that did the trick. And I used your second recommendation as well.

    I don't know if you have any influence over it, but maybe the difference in syntax for c# should be more clearly marked on the relevant msdn pages?

    Thanks again,

    Best regards,

    Dries


    Ken Slovak MVP - Outlook