Monday, 15 February 2010

How do I send a c# vCard to iOS? -



How do I send a c# vCard to iOS? -

i have database application allow user download individual database outlook contacts. programme sends vcard outlook fine on windows machine. on ipad , iphone email, receives vcard text, not vcard attachment.

begin:vcard version:4.0 n;language=en-us:doe;john;;mr. fn:mr. john doe title: org: adr;home;pref;encoding=quoted-printable:;; tel;work;voice: tel;home;voice: tel;cell;voice:(999) 555-1212 tel;work;fax: adr;work;pref;encoding=quoted-printable:;;123 main st new york new york 10000 email;pref;internet:johndoe@gmail.com email;internet: url;work: note: end:vcard

i wonder if not attaching vcard mail service message correctly or if need alter how convert vcard string attachment ios.

my iphone users on ios 7 & 8.

i've done lot of research on topic including http://mobicontact.info/iphone/ios7-supports-vcard-vcf-download-at-last/ haven't found answers specific scenario.

stringbuilder sb = new stringbuilder(); sb.append("begin:vcard\r\n"); sb.append("version:4.0\r\n"); sb.appendformat("n;language=en-us:{0};{1};;{2};\r\n", member.lastname, member.firstname, member.prefix); sb.appendformat("fn:{0} {1} {2}\r\n", member.prefix, member.firstname, member.lastname); sb.appendformat("title:{0}\r\n", member.title); sb.appendformat("adr;home;pref;encoding=quoted-printable:;;{0}\r\n", member.address + " " + member.city + " " + member.city + " " + member.zip); sb.appendformat("tel;work;voice:{0}\r\n", member.workphone); sb.appendformat("tel;home;voice:{0}\r\n", member.homephone); sb.appendformat("tel;cell;voice:{0}\r\n", member.cellphone); sb.appendformat("tel;work;fax:{0}\r\n", member.fax); sb.appendformat("email;pref;internet:{0}\r\n", member.workemail); sb.appendformat("email;internet:{0}\r\n", member.homeemail); sb.appendformat("url;work:{0}\r\n", member.website); sb.appendformat("note:{0}\r\n", member.notes); sb.append("end:vcard\r\n"); string cardcontent = sb.tostring(); byte[] info = encoding.ascii.getbytes(cardcontent); //save info memory stream memorystream ms = new memorystream(data); attachment newattachment = new attachment(ms, searchname.name + ".vcf", "text/x-vcard"); contentdisposition disposition = newattachment.contentdisposition; disposition.creationdate = datetime.now; disposition.modificationdate = datetime.now; disposition.readdate = datetime.now; disposition.dispositiontype = dispositiontypenames.inline; /set new email message mailmessage mailmessage = new mailmessage(); mailmessage.attachments.add(newattachment); //set addresses mailmessage.from = new mailaddress(emailaddress); mailmessage.to.add(emailaddress); //set subject , body mailmessage.subject = "vcard: " + searchname.name; mailmessage.body = "attached vcard festival database"; smtpclient smtp = new smtpclient("cashub.palau.org"); smtp.send(mailmessage);

c# ios vcard

No comments:

Post a Comment