Outlook Addin将自定义字段添加到邮件表单或使用C#访问现有字段 [英] Outlook Addin to add custom field to mail form or accessing existing field with c#

查看:196
本文介绍了Outlook Addin将自定义字段添加到邮件表单或使用C#访问现有字段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要使用外接程序访问Outlook 2007中的"mailto"-字段,并要添加自定义自动完成程序,访问此字段并在c#中添加其他信息的最佳方法是什么?

i want to access the "mailto"- Field in Outlook 2007 with an Addin and want to add a custom autocompleter, what is the best way to access this field and adding additional infos in c#?

想法?

问候

推荐答案

希望这段代码对您有所帮助 ** 1.设置属性

hi hope this code will help you ** 1.Set Property

udfSetPropertyG("Mail Status", GlobalVariables.sPaymentClose, mailitem);
     public void udfSetPropertyG(string sPropName, string sPropValue, OutLook.MailItem mailItem)
            {
                OutLook.UserProperty oOlProperty = default(OutLook.UserProperty);
                oOlProperty = mailItem.UserProperties.Add(sPropName, OutLook.OlUserPropertyType.olText);
                if ((oOlProperty == null))
                {
                    oOlProperty = mailItem.UserProperties.Add(sPropName, OutLook.OlUserPropertyType.olText);
                }
                oOlProperty.Value = sPropValue;
            }

2.将字段应用于Outlook,然后将邮件保持不变

2.apply the field to outlook and then same the mail

udsShowUDFields("Mail Status", mailitem);

            public void udsShowUDFields(string sFldName, OutLook.MailItem mailItem)
            {

                var _with1 = oOlApp.ActiveExplorer().CurrentView as OutLook.TableView;
                try
                {

                    if (_with1.ViewType == OutLook.OlViewType.olTableView)
                    {
                        _with1.ViewFields.Add(sFldName);
                        _with1.Apply();
                    }
                }
                catch (Exception ex)
                {
                    _with1.Apply();
                }
            }

3.保存邮件项目

 mailitem.Save();

这篇关于Outlook Addin将自定义字段添加到邮件表单或使用C#访问现有字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆