using System;
using System.Collections;
using MAPI33;
using MAPI33.MapiTypes;
namespace MAPITUT
{
/// <summary>
/// Test Class for MAPITutorial
/// </summary>
public class TestMain
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main(string[] args)
{
try
{
IMAPISession session = MapiTutorial.StartMapiSession();
session.Logoff(System.IntPtr.Zero, IMAPISession.FLAGS.Default);
ICollection collstores = MapiTutorial.GetMessageStores(session);
IEnumerator enumstores = collstores.GetEnumerator();
System.Console.WriteLine("=========================================");
System.Console.WriteLine("===Print Stores==========================");
System.Console.WriteLine("=========================================");
while (enumstores.MoveNext())
{
ENTRYID storeid = (ENTRYID)enumstores.Current;
IMsgStore store = MapiTutorial.OpenMsgStore(session, storeid);
using (store)
{
IMAPIProp current_msg = (IMAPIProp) store;
using (current_msg)
{
ICollection properties = MapiTutorial.GetMAPIProperties(current_msg);
IEnumerator enumprops = properties.GetEnumerator();
while (enumprops.MoveNext())
{
Value currentprop = (Value) enumprops.Current;
//print:
//the property
//the type
//the value
System.Console.WriteLine(currentprop.PropTag + "\t" + currentprop.GetType() + "\t" + currentprop.ToString());
}
}
}
}
MapiTutorial.CloseMAPISession(session);
System.Console.Read();
}
catch (Exception e)
{
System.Console.WriteLine(e.Message);
}
}
}
}