Home > front end >  .net differentiate Outlook folders
.net differentiate Outlook folders

Time:10-10

I pull the Outlook (365, Exchange server) folders like this:

 Dim otkApp As Outlook.Application = New Outlook.Application
 Dim otkNameSpace As Outlook.NameSpace = otkApp.GetNamespace("MAPI")
 Dim folders = otkNameSpace.Folders

This gets me several additional folders along with those that I see in the Outlook app, for example, I get "Sync Issues", "Quick Step Settings" and "Conversation Action Settings". How can I remove those folders, I don't see any property that is different than those at "Inbox" folder for example. I remove only some of them with a check .DefaultMessageClass = "IPM.Note" (see image).

debug

Edit (based on an Dmitry's answer):

            Dim prop As Boolean = False

            Try
                prop = subfolder.PropertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x10F4000B")
            Catch ex As System.Exception
                prop = False
            End Try

            If prop Or Not subfolder.DefaultMessageClass = "IPM.Note" Then
                Continue For
            End If

This gets rid of most of those folders, but "Sync Issues" remains.

CodePudding user response:

You can skip the folders with PR_ATTR_HIDDEN MAPI property == true. The property (DASL name "http://schemas.microsoft.com/mapi/proptag/0x10F4000B") can be accessed using MAPIFolder.PropertyAccessor.GetProperty. You can see that property in OutlookSpy (click IMAPIFolder button).

  • Related