Web Analytics Made Easy -
StatCounter .NET Interop Outlook Filter mails with attachment/s - CodingForum

Announcement

Collapse
No announcement yet.

.NET Interop Outlook Filter mails with attachment/s

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • .NET Interop Outlook Filter mails with attachment/s

    Hi,

    I want to retrieve all items from outlook inbox that has one or more attachments.


    My current code is:
    Code:
              Outlook.Application objO = new Outlook.Application();
                Outlook.NameSpace objNS = objO.GetNamespace("mapi");
                objNS.Logon("profilename", "password", false, true);
                Outlook.MAPIFolder folderInbox = objNS.GetDefaultFolder(Microsoft.Office.Interop.Outlook.OlDefaultFolders.olFolderInbox);
                Outlook.Items inboxItems = folderInbox.Items;
               inboxItems = inboxItems.Restrict("Count([Attachments]) > 0");
    But the restrict statement is not working. Is anyone here how to do it?

    Thanks.
Working...
X