简体   繁体   English

Outlook Addin将自定义字段添加到邮件表单或使用c#访问现有字段

[英]Outlook Addin to add custom field to mail form or accessing existing field with 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#? 我想访问带有Addin的Outlook 2007中的“mailto”字段,并希望添加自定义自动填充程序,访问此字段以及在c#中添加其他信息的最佳方法是什么?

Ideas? 想法?

greetings 问候

In the past, I did a very simple Outlook Add-in and these samples helped me in some way: 在过去,我做了一个非常简单的Outlook加载项,这些示例在某种程度上帮助了我:

http://msdn.microsoft.com/en-us/library/bb226710%28office.12%29.aspx http://msdn.microsoft.com/en-us/library/bb226710%28office.12%29.aspx

hi hope this code will help you ** 1.Set Property 希望这段代码可以帮助你** 1.设置属性

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.apply the field to outlook and then same the mail 2.将字段应用于Outlook,然后将相同的邮件应用

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.save the mail Item 3.保存邮件物品

 mailitem.Save();

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM