Tuesday, August 26, 2008
Friday, August 15, 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();
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();
}
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
^\d*(\.\d{1,2})?$
matches:
123
123.1
123.12
not matches:
123.
123.123
Tuesday, March 11, 2008
Tuesday, December 25, 2007
My Obsolete Scraper
Great just as I completed writing my scraper google finance now covers ASX listed stocks.
You can do lookups for stock prices in google docs spreadsheets using the "GoogleFinance(Symbol, attribute)" function.
Just enter in the asx code as the symbol along with the attribute your interested in.
Attributes included are:
price: market price of the stock - delayed by up to 20 minutes.
priceopen: the opening price of the stock for the current day.
high: the highest price the stock traded for the current day.
low: the lowest price the stock traded for the current day.
volume: number of shares traded of this stock for the current day.
marketcap: the market cap of the stock.
tradetime: the last time the stock traded.
datadelay: the delay in the data presented for this stock using the googleFinance() function.
volumeavg: the average volume for this stock.
pe: the Price-to-Earnings ratio for this stock.
eps: the earnings-per-share for this stock.
high52: the 52-week high for this stock.
low52: the 52-week low for this stock.
change: the change in the price of this stock since yesterday's market close.
beta: the beta value of this stock.
changepct: the percentage change in the price of this stock since yesterday's close.
closeyest: yesterday's closing price of this stock.
shares: the number of shares outstanding of this stock.
currency: the currency in which this stock is traded.
At first they didn't cover ASX listings, I thought our guys were being jerky hording all their precious data.
You can do lookups for stock prices in google docs spreadsheets using the "GoogleFinance(Symbol, attribute)" function.
Just enter in the asx code as the symbol along with the attribute your interested in.
Attributes included are:
price: market price of the stock - delayed by up to 20 minutes.
priceopen: the opening price of the stock for the current day.
high: the highest price the stock traded for the current day.
low: the lowest price the stock traded for the current day.
volume: number of shares traded of this stock for the current day.
marketcap: the market cap of the stock.
tradetime: the last time the stock traded.
datadelay: the delay in the data presented for this stock using the googleFinance() function.
volumeavg: the average volume for this stock.
pe: the Price-to-Earnings ratio for this stock.
eps: the earnings-per-share for this stock.
high52: the 52-week high for this stock.
low52: the 52-week low for this stock.
change: the change in the price of this stock since yesterday's market close.
beta: the beta value of this stock.
changepct: the percentage change in the price of this stock since yesterday's close.
closeyest: yesterday's closing price of this stock.
shares: the number of shares outstanding of this stock.
currency: the currency in which this stock is traded.
At first they didn't cover ASX listings, I thought our guys were being jerky hording all their precious data.
Subscribe to:
Posts (Atom)