如何使用 ASP.NET Outlook 附加组件在 SQL Server 中存储 Outlook 正文文本电话号码(或)选定区域?

发布于 2025-01-01 21:48:22 字数 216 浏览 5 评论 0原文

我在VS2010中使用Windows应用程序OutlookAddIn1(office-2007),现在我的收件箱有一些邮件,每封邮件都有电话号码,现在我的任务是选择电话号码并单击鼠标右键,我将会出现保存文本或保存数字选项,然后选择该选项将该文本存储到 sql server2008 数据库表中,请帮助我的任何人了解该主题,请给出任何想法,这非常好紧急任务

谢谢 赫曼斯

i am using windows application OutlookAddIn1(office-2007) in VS2010, now my inbox have some mails and each mail have phone numbers , now my task is select the phone number and click the mouse right click , i have save text or save number option will appear how it is possible and select that option store that text into sql server2008 database table pls help my any one have idea about that topics , pls give any idea it is very urgent task

Thank u
hemanth

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

吃不饱 2025-01-08 21:48:22
 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);
        }        
 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);
        }        
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文