コード例 #1
0
        private void Page_Load(object sender, System.EventArgs e)
        {
            // Put user code to initialize the page here

            MAPI.Session session = new SessionClass();
            //session.Logon(
            session.GetType().InvokeMember("Logon", BindingFlags.InvokeMethod, null, session, new Object[] { "*****@*****.**", "raghu123", false });
            AddressLists addrs = null;

            try
            {
                addrs = (AddressLists)session.AddressLists;
            }
            catch (Exception ex)
            {
                Response.Write(ex.Message); Response.End();
            }
            int addrCnt = (int)addrs.Count;

            for (int i = 0; i < addrCnt; i++)
            {
                AddressList curAddr = (AddressList)addrs.get_Item(i);
                Response.Write(curAddr.Name + "&nbsp;:" + ((AddressEntry)((AddressEntries)curAddr.AddressEntries).get_Item(0)).Name + "BR>");
            }
        }
コード例 #2
0
ファイル: Form1.cs プロジェクト: benjamincrane/playground
        static void Main()
        {
            //Application.Run(new frmCtrlConsumer());
            MAPI.Session session = new SessionClass();
            session.GetType().InvokeMember("Logon", BindingFlags.InvokeMethod, null, session, new Object[] {});
            AddressLists addrs = null;

            try
            {
                addrs = (AddressLists)session.AddressLists;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message); return;
            }
            int    addrCnt = (int)addrs.Count;
            string x       = "";

            for (int i = 1; i <= addrCnt; i++)
            {
                AddressList curAddr = (AddressList)addrs.get_Item(i);
                x += (string)curAddr.Name + ":\n";
                AddressEntries entries  = (AddressEntries)curAddr.AddressEntries;
                int            entryCnt = (int)entries.Count;
                for (int j = 1; j <= entryCnt; j++)
                {
                    AddressEntry curEntry = (AddressEntry)entries.get_Item(j);
                    string       address;
                    try{ address = (string)curEntry.Address; }catch { address = "<null>"; }
                    x += (string)curEntry.Name + ": " + address + " -> " + (int)curEntry.DisplayType + "\n";
                }
            }
            MessageBox.Show(x);
        }