Outlook Addin to add custom field to mail form or accessing existing field with c#

烈酒焚心 提交于 2019-12-10 22:03:19

问题


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#?

Ideas?

greetings


回答1:


In the past, I did a very simple Outlook Add-in and these samples helped me in some way:

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




回答2:


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.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.save the mail Item

 mailitem.Save();


来源:https://stackoverflow.com/questions/2955853/outlook-addin-to-add-custom-field-to-mail-form-or-accessing-existing-field-with

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!