contact.vcf Vcard似乎不是有效的名片。 Windows手机8.1 C#

时间:2016-01-21 21:11:42

标签: c# .net windows-phone-8 windows-phone-8.1 vcard

我在Windows Phone 8.1应用程序中创建了一张Vcard(名片)。 mycontact.vcf。

我将该卡存储到手机内存中。当我尝试打开警报显示时,mycontact.vcf似乎不是有效的名片(Vcard)。

当我在记事本中打开相同的文件时,那里显示值数据。 我想在Windows联系人中打开它。 我的代码在这里。

  var vcf = new StringBuilder();
  vcf.Append("Category:" + currentcontact.title + System.Environment.NewLine);

  StorageFolder folder = Windows.Storage.KnownFolders.PicturesLibrary; 
  StorageFile sampleFile = await folder.CreateFileAsync("mycontact.vcf", CreationCollisionOption.ReplaceExisting);
  await Windows.Storage.FileIO.WriteTextAsync(sampleFile, vcf.ToString());

创作或其他任何事情都有问题。 我也附上了屏幕截图。 enter image description here

我很感激你的帮助。

1 个答案:

答案 0 :(得分:1)

你所写的内容根本不是vCard。

  • 所有vCard文件必须以" BEGIN:VCARD"开头。以" END:VCARD"。
  • 结束
  • 所有vCard必须具有VERSION属性。
  • "分类"不是有效的财产

我认为这就是你想要的。

BEGIN:VCARD
VERSION:3.0
CATEGORIES:...
END:VCARD

我拿现金或信用卡。