bolorundurowb / vcardlib Goto Github PK
View Code? Open in Web Editor NEW📇 A .NET standard library for reading and writing vCard files
Home Page: https://github.com/bolorundurowb/vCardLib/blob/master/README.md
License: MIT License
📇 A .NET standard library for reading and writing vCard files
Home Page: https://github.com/bolorundurowb/vCardLib/blob/master/README.md
License: MIT License
Hi, I tried to update to the latest version and I found some problems.
I did add to the lib an extra field to be able to specify the name of a custom telephone type. Is it possible to re-add it?
Original thread: Add support for custom telephone types #58
Hello
Because of your dependency of "CoreCompat.System.Drawing.v2" it's not possible to deploy on a real iOS Device, the linker will fail with the following message: "carbon framework not found"...
I removed this dependency (remove photo support) for the moment to get it working.
Best Greetings
Shouldn't the type of property BirthDay
be DateTime?
instead of DateTime
? IMHO, returning {1/1/0001 12:00:00 AM}
when the vcard file does not have this information is bit wrong.
If I use the serializer with version 3, I have the problem that closing brackets appear in the code. For example at the phone number. This is also visible in the file v3Serializer.cs. Because of this the vCard can not be interpreted.
In both examples I used the same data:
BEGIN:VCARD
VERSION:2.1
REV:20211125T085009Z
N:Muster;Andreas;;;
KIND:Individual
GENDER:None
TEL;WORK: 4123456789
TEL;CELL: 41987654321
EMAIL;WORK:[email protected]
ADR;WORK:Gewerbepark,1234 Musterstadt,Österreich
END:VCARD
BEGIN:VCARD
VERSION:3.0
REV:20211125T085038Z
N:Muster;Andreas;;;
KIND:Individual
GENDER:None
TEL);TYPE=WORK: 4123456789
TEL);TYPE=CELL: 41987654321
EMAIL);TYPE=WORK:[email protected]
ADR);TYPE=WORK:Gewerbepark,1234 Musterstadt,Österreich
END:VCARD
Ran with vCardLib/vCardLib.Tests/v4.vcf
at vCardLib.Deserializers.v4Deserializer.ParseAddresses(String[] contactDetails)
at vCardLib.Deserializers.Deserializer.Deserialize(String[] contactDetails)
at vCardLib.Deserializers.Deserializer.GetCardFromContact(String[] contact)
at System.Linq.Enumerable.SelectArrayIterator`2.ToList()
at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
at vCardLib.Deserializers.Deserializer.CreateCardsFromContacts(IEnumerable`1 contacts)
at vCardLib.Deserializers.Deserializer.FromFile(String filePath)
at source.cs:line 39
version = float.Parse(versionString.Replace("VERSION:", "").Trim());
results in wrong results if in CultureSettings is defined that the decimal seperator is not "." as in german (we using ,)
i replaced it with:
float version;
string dSep = CultureInfo.CurrentUICulture.NumberFormat.NumberDecimalSeparator;
if (dSep.Equals(",")) {
version = float.Parse(versionString.Replace("VERSION:", "").Trim().Replace(".", ","));
} else {
version = float.Parse(versionString.Replace("VERSION:", "").Trim());
}
I have a vCard (vcf) created from an apple addressbook that contains tons of 'item1' or 'item2' lines. The content of these lines do not seem to be accessible in a vCardCollection. This is an issue for me as the vast majority of email addresses and physical addresses for the contacts are stored in these.
Example vCard from my .vcf:
BEGIN:VCARD
VERSION:3.0
PRODID:-//Apple Inc.//Mac OS X 10.11.6//EN
N:xxx;xxx;;;
FN:xxx xxx
EMAIL;type=INTERNET;type=HOME;type=pref:xxx
TEL;type=CELL;type=VOICE;type=pref:xxx
ADR;type=HOME;type=pref:;;xxx;
item1.ADR:;;xxx;
item1.X-ABLabel:Son's home
UID:56d0a99f-224f-4523-b888-f0389f700058
X-ABUID:EF271691-7039-43D1-9E9C-C75D6A6010F6:ABPerson
END:VCARD
BEGIN:VCARD
VERSION:3.0
PRODID:-//Apple Inc.//Mac OS X 10.11.6//EN
N:xxx;xxx;;;
FN:xxx xxx
EMAIL;type=INTERNET;type=HOME;type=xxx
TEL;type=CELL;type=VOICE;type=pref:xxx
ADR;type=HOME;type=pref:;;xxx;
UID:718c2455-de2f-483f-8abc-c7fe317f3232
X-ABUID:718C2455-DE2F-483F-8ABC-C7FE317F3232:ABPerson
END:VCARD
BEGIN:VCARD
VERSION:3.0
PRODID:-//Apple Inc.//Mac OS X 10.11.6//EN
N:;;;;
FN:Apple Inc.
ORG:Apple Inc.;
TEL;type=MAIN;type=pref:1-800-MY-APPLE
item1.ADR;type=WORK;type=pref:;;1 Infinite Loop;Cupertino;CA;95014;United States
item1.X-ABADR:us
item2.URL;type=pref:http://www.apple.com
item2.X-ABLabel:_$!<HomePage>!$_
X-ABShowAs:COMPANY
UID:4F001569-0C4B-4E68-8444-26A705D04FC6
X-ABUID:51388BA1-125E-44D1-A906-CD4485BAFC97:ABPerson
END:VCARD
The FormattedName
field in the vCard seems to be an unparsed N
field rather than the FN
field
Hello,
when using your sample code the import is not working for me. The object is just empty even though the vcf has content. Do i have to do anything else except your example code?
(Net 4.6 and V.1.1.1 of vCardLib.dll from NuGet)
Thanks
Hello, We would like to report that a System.NotImplementedException
is thrown when attempting to serialize a vCard
instance that had Version = vCardVersion.V4
.
The issue exists in version up to 4.0.1
Hi, I'm serializing multiple vcards, and the Start/End frame is generated on the same line, breaking the import in Android.
Basically it generates a vard that looks like
[...]
GENDER:None
END:VCARDBEGIN:VCARD
VERSION:3.0
[...]
but I'm expecting
[...]
GENDER:None
END:VCARD
BEGIN:VCARD
VERSION:3.0
[...]
Any tips?
Thank you
Данное решение не поддерживает кирилицу для Android.
В целом отсутсвует поддержка Encoding 👎
Взял себе на машину допилил Encoding для ios создаю Encoding.Unicode, а вот Android не получается ни как организовать.
VCF exported from GMail has the line:
EMAIL;TYPE=INTERNET;TYPE=HOME:[email protected]
This line parses as:
◢ | EmailAddresses | Count = 1 | System.Collections.Generic.List<vCardLib.Models.EmailAddress>
| ◢ [0] | {vCardLib.Models.EmailAddress} | vCardLib.Models.EmailAddress
| Email | "INTERNETHOME:[email protected]" | string
| Type | None | vCardLib.Enums.EmailType
Install-Package : ZIP archive contains unsupported data structures.
At line:1 char:16
Ran with vCardLib/vCardLib.Tests/v3.vcf
. The pictures list only contains the two URL photos.
When I try to save collection of vCards the END:VCARD
and new BEGIN:VCARD are writen in the same line,
and when I try to imported that file I get error.
If I manualy make linebreke with text editor and save file i can import multiple files...
my sample write code:
var cardList = new vCardCollection();
for (int i = 1; i < result.Tables[0].Rows.Count; i++)
{
DataRow row = result.Tables[0].Rows[i];
var card = new vCard();
card.Version = vCardLib.Helpers.Version.V3;
card.GivenName = row[0].ToString();
card.FamilyName = row[1].ToString();
var vca = new vCardLib.Models.EmailAddress();
vca.Email = new System.Net.Mail.MailAddress(row[2].ToString());
card.EmailAddresses.Add(vca);
var phone = new vCardLib.Models.PhoneNumber();
phone.Number = row[3].ToString();
card.PhoneNumbers.Add(phone);
cardList.Add(card);
}
cardList.Save("test.vcf", vCardLib.Helpers.Version.V3, vCardLib.Helpers.WriteOptions.Overwrite);
There's currently support for deserializing using a stream, but not to serialize to a stream.
This would be helpful to directly write to files or HTTP bodies etc.
Hi @bolorundurowb -
Thank you for making this library! Do you have any plans to expand this to enable custom properties? I'm wanting to make my app export a contact list that can be imported into Skype and it needs to support properties like X-SKYPE-DISPLAYNAAME
Thanks!
Hi, I'm serializing some vcard and to be able to unit test the serialized content in a simple way, I need to have an idempotent content.
As today the parameter Revision
is not respected, and DateTime.Now is used instead.
As example:
var contacts = new List<vCardLib.Models.vCard> {
new() {
Version = vCardVersion.V3,
Revision = new DateTime(2020, 01, 01),
NickName = "A name",
}
};
Serializer.Serialize(contacts);
Any suggestion?
Thank you
The first name and last name during serialization (and maybe deserialization) is wrong. The current output of John Doe
is:
N:John;Doe;
FN:John Doe
which should be:
N:Doe;John;;;
FN:John Doe
As per the Rfc2426, the value for token N
is:
Family; Given; Middle; Prefix; Suffix
Lastly, IMHO, the vCard
class should have these additional properties:
For Frapid framework, we're already using this library and would like to offer a helping hand.
BEGIN:VCARD
VERSION:2.1
N:;.;;;
FN:.
END:VCARD
BEGIN:VCARD
VERSION:2.1
N;CHARSET=UTF-8;ENCODING=QUOTED-PRINTABLE:xxxxxxx;;;
FN;CHARSET=UTF-8;ENCODING=QUOTED-PRINTABLExxxxxx
TEL;CELL:+70000000000
END:VCARD
I tried the library with a vcf-file, which contains multiple vcf-cards. There will be created multiple vCard objects, but all their properties are null (although, they are NOT null in the vcf-file for sure).
On example vcard:
BEGIN:VCARD
VERSION:3.0
FN:
N:;;;;
EMAIL;TYPE=INTERNET:[email protected]
END:VCARD
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.