C# 从 Outlook 将所有联系人导出为电子名片

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/208890/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-03 18:08:59  来源:igfitidea点击:

Export all contacts as vcards from Outlook

c#.netoutlookvcard

提问by Jonas Lincoln

So, I want to export all my contacts from Outlook as vcards. If I google that, I get a bunch of shareware programs, but I want something free that just works.

因此,我想将 Outlook 中的所有联系人导出为 vcard。如果我用谷歌搜索,我会得到一堆共享软件程序,但我想要一些免费的东西。

If I'm to code it myself, I guess I should use the Microsoft.Office.Interop.Outlook assembly. Has anyone already code to convert ContactItems to vcards?

如果我要自己编写代码,我想我应该使用 Microsoft.Office.Interop.Outlook 程序集。有没有人已经编码将 ContactItems 转换为 vcards?

Edit:I solved it in a completely different way, see answer below, but I have marked dok1.myopenid.com's answer as accepted because it answers my original question.

编辑:我以完全不同的方式解决了它,请参阅下面的答案,但我已将 dok1.myopenid.com 的答案标记为已接受,因为它回答了我原来的问题。

采纳答案by Jonas Lincoln

I solved it in a non-programmatically way:

我以非编程方式解决了它:

  • Selected all contacts in Outlook
  • Forwarded them as cards to myself
  • Saved all the attachments (vcards) in a folder, c:\temp
  • Opened a command prompt and typed the command copy /a *.vcf c:\allcards.vcfwhich concatenates all vcards into one
  • 选择 Outlook 中的所有联系人
  • 将它们作为卡片转发给我自己
  • 将所有附件(vcards)保存在一个文件夹中, c:\temp
  • 打开命令提示符并键入将copy /a *.vcf c:\allcards.vcf所有 vcards 连接成一个的命令

回答by DOK

They sure make it hard to find, don't they? See if this helps. http://msdn.microsoft.com/en-us/library/aa579624(EXCHG.80).aspx

他们肯定很难找到,不是吗?看看这是否有帮助。 http://msdn.microsoft.com/en-us/library/aa579624(EXCHG.80).aspx

That includes: The following example uses the CDO Person object to obtain vCard information for a contact.

其中包括: 以下示例使用 CDO Person 对象获取联系人的 vCard 信息。

Dim oPerson As New CDO.Person
Dim strm As New ADODB.Stream

' Assume strURL is a valid URL to a person contact item
oPerson.DataSource.Open strURL

' You can set the ADO Stream object to the returned vCard stream
Set strm = oPerson.GetvCardStream

' Save the stream to a file.
' Note: using adSaveCreateOverwrite may cause an existing
' contact to be overwritten.
strm.SaveToFile "d:\vcard.txt", adSaveCreateOverwrite

' You don't have to set a Stream object,
' just use the Stream methods off GetvCardStream directly
oPerson.GetvCardStream.SaveToFile "d:\vcard.txt", adSaveCreateOverwrite

Yep, the only code sample there is in VB.

是的,唯一的代码示例是在 VB 中。

回答by Joe

Just purchased the X8 and was about to get really really mad when I couldn't easily transfer my contacts...until I started snooping around on the phone.

刚刚购买了 X8,当我无法轻松转移我的联系人时,我真的很生气……直到我开始在手机上四处窥探。

First, export all your contacts in Outlook to vCards (I found emailing them to yourself is the easiest. If you get an error message "to many attachments..." you can save them from the email in your sent items folder) and copy the vCards to the memory card on your phone.

首先,将 Outlook 中的所有联系人导出到 vCards(我发现将它们通过电子邮件发送给自己是最简单的。如果您收到错误消息“to many attachments...”,您可以将它们从电子邮件中保存到您的已发送邮件文件夹中)并复制vCards 到手机上的存储卡。

Second, open your address book on the phone then press the left button on the phone (the button with 4 little squares above it. NOT THE 4 BOXES ON THE SCREEN...THE PHYSICAL BUTTON!).

其次,在手机上打开你的地址簿,然后按下手机上的左键(上面有 4 个小方块的按钮。不是屏幕上的 4 个框......物理按钮!)。

Third, select "Import/Export" and choose import from memory card. Import all vCard files and you should be golden.

第三,选择“导入/导出”并选择从存储卡导入。导入所有 vCard 文件,您应该是金子。

Best of luck...don't ask me any questions because I will not be back to look at any more posts...just passing by trying to figure it out on my own.

祝你好运...不要问我任何问题,因为我不会回来看更多的帖子...只是路过试图自己弄清楚。

回答by Sam Reynolds

For what it's worth - I just came across this thread looking for the same export to individual .VCF files from outlook. I haev 2007 (don't know if that makes a difference) but I selected all contacts and dragged them to a new email message to be added as individual .VCF files. After they were all added, I clicked in the attachments section of the new email, hit CTRL-A to highlight all of them, then left-click-dragged the first (and therefore all of them) to the folder I wanted the individual .VCF files in. A few minutes of Outlook "thinking" about my 400 contacts they were all there!

对于它的价值 - 我刚刚遇到这个线程,正在寻找从 Outlook 导出到单个 .VCF 文件的相同内容。我是 2007 年(不知道这是否有所不同),但我选择了所有联系人并将它们拖到新的电子邮件中,以作为单独的 .VCF 文件添加。添加完所有内容后,我单击新电子邮件的附件部分,按 CTRL-A 突出显示所有附件,然后左键单击并拖动第一个(因此所有)到我想要的文件夹。 VCF 文件。几分钟的 Outlook “思考”了我的 400 个联系人,他们都在那里!