如何解读outlook中的电子邮件地址 [英] How to unscramble an email address from outlook

查看:165
本文介绍了如何解读outlook中的电子邮件地址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嘿伙计



好​​吧我不确定是否有一个明确的方式来真正陈述这个问题,但我会尽我所能并提供尽可能多的信息尽可能。



我写了一个C#程序,它将功能区选项卡添加到outlook 2010,并使我能够将所选数据集成到我的数据库中,例如构建我自己的联系人,电子邮件等几乎就像一本地址簿,但有额外的信息对日常活动的流动很有用。



到目前为止,我已经为我做了一切,但是有时候电子邮件地址的价值有问题。如果我收到来自Gmail帐户或其他类型帐户的电子邮件,则会完美地使用此代码:



 Outlook.MailItem mailItem =(selectedObject  as  Outlook.MailItem); 
string email = ;
email = mailItem.SenderEmailAddress.ToString(); // 添加ToString()以查看是否有任何改变...它不会(OO')





但是,如果我试图从某些联系人那里获取电子邮件地址,那么它似乎是抽象的:



而不是: demo@test.org

它会显示:

 / O =第一个组织/ OU =交换行政组(FYDIBOHF23SP)/ CN = RECIPIENTS / CN = TestE< br /> 
,其中'TestE'是电子邮件地址。





当然我认为这是因为它是一个交换服务器/邮件帐户。



但是当我在另一台PC上办公室并再次测试时,电子邮件地址完全通过了。所以我试图通过从outlook中的联系人列表中获取电子邮件地址来绕过该​​方法,如下所示:

  if (email.Contains(  /;))
{
AccessContacts(接触); // 联系人变量包含发件人的姓名和姓氏

}

public void AccessContacts( string contactName)
{

outlookObj = new Microsoft.Office.Interop.Outlook.Application();

Outlook.MAPIFolder folderContacts = this .outlookObj.ActiveExplorer()。Session。
GetDefaultFolder(Outlook.OlDefaultFolders.olFolderContacts);
Outlook.Items searchFolder = folderContacts.Items;
int counter = 0 ;
foreach (Outlook.ContactItem foundContact in searchFolder)
{
if (foundContact.LastName.Contains(contactName))
{
foundContact.Display( false < /跨度>);
counter = counter + 1 ;
}
}
MessageBox.Show( 你有 + counter +
姓名为
+ contactName +的姓氏的联系人 );
}



但我一直遇到错误和问题......我还是新编程,所以我可能只是在我的代码中做一些非逻辑的事情...因为我目前工作有点超负荷,并匆匆打了很多这个。



无论如何你能帮我吗?如果您需要更多信息或任何信息,请通知我。我已经尝试了我能想到的一切。



谢谢。



(我到处寻求帮助在这方面,但大多数似乎只有视觉工作室2013的帮助,我知道它附带一个史诗般的工具,显然使这种任务更容易,但它只是Oulook 2013兼容,我需要它为Outlook 2010 )

解决方案

此问题已经解决,参考的好地方是JoséAmílcarFerreiraCasimiro在评论中给出的页面。 =)感谢所有的帮助。





编辑:[VICK] ...链接在这里添加评论。







Quote:

阅读这篇文章:http://blogs.msdn.com/b/akashb/archive/2008/12/19/how-to-get-details-about-a-exchange-user-in-outlook-2007-outlook -2003.aspx


Hey Guys

Okay I am not sure if there is a clear way to really state this question, but I'll do my best and give as much information as possible.

I wrote a C# program that adds a ribbon to the ribbon tab to outlook 2010 and enables me to integrate selected data into my database, for example build my own contact, email etc almost like an address book, but with extra information that are useful for the flow of day to day activities.

So far I have everything going for me, but there's a problem with the value of the email addresses sometimes. If I receive an email from a gmail account or another type of account, it pulls through perfectly using this code:

 Outlook.MailItem mailItem = (selectedObject as Outlook.MailItem);
string email = "";
email = mailItem.SenderEmailAddress.ToString(); //added ToString() to see if that changes anything... it doesn't (OO')



But it would seem that if I try to obtain the email address from certain contacts, it comes out abstract:

instead of: demo@test.org
it will display this:

/O=FIRST ORGANIZATION/OU=EXCHANGE ADMINISTRATIVE GROUP (FYDIBOHF23SP)/CN=RECIPIENTS/CN=TestE<br />
with the 'TestE' being the start of the email address.



naturally I assumed it is due to the fact that it is an exchange server/mail account.

but when I sat up office on a different PC and tested this again, the email address pulled through perfectly. So I have tried bypassing the method by getting the email address from the contact list in outlook as follows:

if (email.Contains("/";))
     {
       AccessContacts(contact); //contact variable contains name and surname of sender

     }

public void AccessContacts(string contactName)
        {
           
           outlookObj = new Microsoft.Office.Interop.Outlook.Application();
 
            Outlook.MAPIFolder folderContacts = this.outlookObj.ActiveExplorer().Session.
             GetDefaultFolder(Outlook.OlDefaultFolders.olFolderContacts);
            Outlook.Items searchFolder = folderContacts.Items;
            int counter = 0;
            foreach (Outlook.ContactItem foundContact in searchFolder)
            {
                if (foundContact.LastName.Contains(contactName))
                {
                    foundContact.Display(false);
                    counter = counter + 1;
                }
            }
            MessageBox.Show("You have " + counter +
                " contacts with last names that contain "
                + contactName + ".");
        }


but I keep getting errors and problems... I am still new to programming, so it's possible I'm just doing something unlogical in my code... cause I am currently a little overloaded with work and typed a lot of this in a rush.

Please is there anyway you can help me? If you need more information or anything let me know. I have tried everything I can think of.

Thanks.

(I have searched everywhere for help on this, but mostly it seems there is only help for visual studio 2013, and i am aware that it comes with an epic tool that apparently makes this kind of task easier, but it's only Oulook 2013 compatible, and i need it for Outlook 2010)

解决方案

This Question has been solved, a good place for referencing is the page José Amílcar Ferreira Casimiro gave in the comments. =) thanks for all the help.


EDIT:[VICK]... Link Added from the comment here.



Quote:

Read this article: http://blogs.msdn.com/b/akashb/archive/2008/12/19/how-to-get-details-about-a-exchange-user-in-outlook-2007-outlook-2003.aspx


这篇关于如何解读outlook中的电子邮件地址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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