Saturday, November 8, 2008

Tuesday, July 29, 2008

Obtaining email address from MAPI message

MAPI.Recipients recipients = (MAPI.Recipients)message.Recipients;
MAPI.Recipient recipient = (MAPI.Recipient)recipients.get_Item(1);
MAPI.AddressEntry addressEntry = (MAPI.AddressEntry)recipient.AddressEntry;

string emailAddress = addressEntry.Address.ToString();

Friday, July 25, 2008

MAPI - Connecting to a mailbox and looping through the inbox

Note: You'll need to reference the COM library "Microsoft CDO 1.21 Library"

MAPI.Session session = new MAPI.Session();
string profileInfo = "EXCHANGE_SERVER" + "\n" + "MAILBOX_NAME";
session.Logon("PROFILE_NAME", System.Reflection.Missing.Value, true, System.Reflection.Missing.Value, System.Reflection.Missing.Value, System.Reflection.Missing.Value, profileInfo);

// Get the folder
MAPI.Folder inboxFolder = session.Inbox as MAPI.Folder;

// Enumerate messages
MAPI.Messages messages = (MAPI.Messages)inboxFolder.Messages;
MAPI.Message message = (MAPI.Message)messages.GetFirst(null);
while (message != null)
{
// do stuff with the message
try
{
message = (MAPI.Message)messages.GetNext();
if (message != null)
{
textBox1.Text += message.Subject.ToString();
}
}
catch (Exception ex)
{
textBox1.Text = ex.Message.ToString();
return;
}
}


session.Logoff();
}

Monday, May 26, 2008

Decimal Regular Expression

The following regular expression checks for a number that can contain up to two decimal places.

^\d*(\.\d{1,2})?$

matches:

123
123.1
123.12

not matches:

123.
123.123

Tuesday, March 11, 2008

ASX Indices

http://www.asx.com.au/research/indices/description.htm