private void savenumbers()
{
try
{
Outlook.Application oApp;
Outlook.Explorer oExp;
Outlook.Selection oSel;
object oItem;
long i;
// TODO: On Error GoTo Warning!!!: The statement is not translatable
oApp = new Outlook.Application();
oExp = oApp.ActiveExplorer();
oSel = oExp.Selection;
if ((oSel.Count == 0))
{
System.Windows.Forms.MessageBox.Show("Nothing selected");
return;
}
for (i = 1; i <= oSel.Count; i++)
{
oItem = oSel[i];
DisplayMessage(oItem);
}
}
catch (System.Exception ex)
{
System.Windows.Forms.MessageBox.Show("Error " + ex.Message.ToString());
}
}
public int outlooksavenumber(string testcopy)
{
int ReturnValue = 0;
ReturnValue = SqlHelper.ExecuteNonQuery(LITRMSConnection, "usp_Outlooksavenumbers",
new SqlParameter("@testcopy", testcopy));
return ReturnValue;
}
void DisplayMessage(object oItem)
{
//Outlook.MailItem oMailItem;
Outlook.MailItem oMail = (Outlook.MailItem)oItem;
//System.Windows.Forms.MessageBox.Show(oMail.Subject);
//System.Windows.Forms.MessageBox.Show(oMail.Body);
string body = oMail.Body;
Outlook.Inspector inspector = oMail.GetInspector;
// Obtain the Word.Document object from the Inspector object
Microsoft.Office.Interop.Word.Document document = (Microsoft.Office.Interop.Word.Document)inspector.WordEditor;
// Copy the selected objects
string testcopy = "";
testcopy = document.Application.Selection.Text;
outlooksavenumber(testcopy);
}