简体   繁体   English

如何使用c#从外部应用程序访问特定文件夹中的Outlook 2013联系人?

[英]How can I access Outlook 2013 contacts in a certain folder from an external app using c#?

I need to import 3 different folders of Outlook 2013 contacts into Dynamics CRM Online for one of our clients. 我需要为我们的一位客户将3个不同的Outlook 2013联系人文件夹导入Dynamics CRM Online。 I cannot use the CRM Online Outlook connector because the CRM account I need to import them with is not the same as the AD credentials of the machine I need to import them with. 我无法使用CRM Online Outlook连接器,因为我用来导入它们的CRM帐户与我用来导入它们的计算机的AD凭据不同。 I also want to avoid any side effects from 我也想避免任何副作用

I cannot export the data to a .csv file and import them in CRM Online because the data is quite mangled after the export, with excess linebreaks, sometimes multiple in 1 field. 我无法将数据导出到.csv文件,也无法将它们导入CRM Online,因为导出后数据非常混乱,带有过多的换行符,有时在1字段中为多个。 So I need to use an external application for this, which need to get the proper contacts in Outlook, parse them to CRM contacts, and then insert them. 因此,我需要为此使用外部应用程序,该应用程序需要在Outlook中获取适当的联系人,将其解析为CRM联系人,然后将其插入。

I have 5 folders of contacts in my Outlook 2013 contacts tab, but only 3 of them are the client's. 我的Outlook 2013“联系人”选项卡中有5个联系人文件夹,但其中只有3个是客户端的。 the rest may not under any circumstances be imported. 其余在任何情况下均不得进口。 How can I extract ONLY these 3 folders from my contacts tab while leaving the rest where they are? 我如何才能从“联系人”选项卡中仅提取这三个文件夹,而将其余文件夹保留在原处?

You need to write code to retrieve the Outlook contacts. 您需要编写代码来检索Outlook联系人。 You can do this in C# using the Outlook Interop libraries. 您可以使用Outlook Interop库在C#中执行此操作。 Given that this is a one-time task, I'm assuming, I would just use a Console application. 考虑到这是一项一次性任务,我假设我将只使用控制台应用程序。 Unless you are experienced with the Outlook Interop library you'll probably need to do some trial-and-error work. 除非您有使用Outlook Interop库的经验,否则您可能需要做一些反复试验的工作。 I usually find this is the case when writing against the Office libraries. 我通常会在针对Office库编写内容时遇到这种情况。

Examples can be found at: 可以在以下位置找到示例:

Specifically about contacts: Get Outlook contacts into C# form-based application 特别是关于联系人:将Outlook联系人放入基于C#表单的应用程序中

Not specifically about contacts but when combined with the above answer should get you close to a start: Can I read an Outlook (2003/2007) PST file in C#? 与联系人无关,但是与上面的答案结合使用时,您应该可以入门了: 我可以在C#中读取Outlook(2003/2007)PST文件吗?

Information on adding the Office Primary Interop Assembly that you'll need: http://msdn.microsoft.com/en-us/library/15s06t57.aspx 有关添加所需的Office Primary Interop程序集的信息: http : //msdn.microsoft.com/zh-cn/library/15s06t57.aspx

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

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