开发者

.vcf file not opening

I am trying to create a .vcf file programmatically in C#, and writing a bunch of strin开发者_Python百科gs in the correct format in that file. But when i try to open it manually, the following message appears.

Could not start Microsoft Outlook.The file maynot exist, you may not have permission to open it, or it may be open in another program.

But when i create a text file manually write the same bunch of strings in the vcard format and change the extension to .vcf and then open the file, it opens properly with outlook

Any help!!!


You don't say so explicitly, so I have to ask: have you elimated all of the suggestions Outlook gives you? The file isn't currently still open with a lock by your program? The file permissions are such that it can be read by the outlook user? The file does exist?


This reply may help someone. I got a similar error, the problem for me was that there was no data in the vcf file. As soon as i printed the VCARD info after the headers (and then opened the resultant vcf file) the error disappeared.

My error


Verify you used CrLf for line terminiators in your code. If you use Environment.NewLine or just \n's, that may be the problem.


You probably saved the file as UTF-8 or Unicode. To test, open the file in VS in binary, delete the first three bytes and see if the file opens.


Had a very similar problem when constructing a .vcf file from a vCard string. The contact form would be completely blank when opening in Outlook. I solved the problem by converting the string to a UTF8 Encoded Byte Array.

byte[] vCard = System.Text.UTF8Encoding.UTF8.GetBytes(vCardString);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜