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
  1. Home
  2. General Programming
  3. .NET (Core and Framework)
  4. Get distribution list address using Outlook 12.0 Object Library

Get distribution list address using Outlook 12.0 Object Library

Scheduled Pinned Locked Moved .NET (Core and Framework)
comhelptutorialquestion
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    Glenn E Lanier II
    wrote on last edited by
    #1

    I'm trying to get the email addresses contained in a distribution list in a public folder using the Outlook 12.0 Object Library. I can get the distribution list (as Outlook._DistListItem), but can not figure out how to get the addresses contained in it. Does anyone have an idea/pointer that would help?

    using Outlook = Microsoft.Office.Interop.Outlook;
    
    outlook = new Outlook.Application();
    Outlook._NameSpace olNS = outlook.GetNamespace("MAPI");
    Outlook.MAPIFolder oPublicFolder = olNS.GetDefaultFolder(Microsoft.Office.Interop.Outlook.OlDefaultFolders.olPublicFoldersAllPublicFolders);
    
    Outlook.MAPIFolder tiFolder = null;
    foreach (Outlook.MAPIFolder currentFolder in oPublicFolder.Folders)
    {
       if ("DesiredFolder" == currentFolder.Name)
       {
          tiFolder = currentFolder;
          break;
       }
    }
    if (null != tiFolder)
    {
       Outlook._Items oItems = tiFolder.Items;
       for (int i = 1; i <= oItems.Count; i++)
       {
          try
          {
             Outlook._ContactItem oContact = (Outlook._ContactItem)oItems[i];
          }
          catch (Exception ex)
          {
             try
    	 {
    	    Outlook._DistListItem distributionList = (Outlook._DistListItem)oItems[i];
                // distributionList is thing I want; need to get members
                // :confused: :confused: :confused:
             }
             catch (Exception ex1)
    	 {
             }
          }
    }
    
    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

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