Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
E

Ed Arnone

@Ed Arnone
About
Posts
1
Topics
0
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Outlook.MailItem Issues
    E Ed Arnone

    The below section should assist anyone attempting to use the MailItem object. The key to this code not throwing exceptions is that the items collection may contain more than just MailItems and therefore the following code allows you to retrieve just the MailItems from the collection.

    //create an instance of Outlook
    Outlook.Application olApp = new Outlook.Application();
    //create a MAPIFolder object pointed to the default inbox
    Outlook.MAPIFolder inBox = (Outlook.MAPIFolder)olApp.ActiveExplorer().Session.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderInbox);
    //create an Items collection and pass in the inbox items
    Outlook.Items Inboxitems = inBox.Items;

    //loop through the items that are MailItem and collect the size of the items
    //to get the total size of the inbox
    foreach (Outlook.MailItem item in Inboxitems.OfType())
    {
    InboxSize = InboxSize + item.Size;
    }

    Obviously once you have a handle to the individual Mailitem you can access all of it's properties. Happy Coding :)

    C# com tools help question
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups