pinoaffe / org-vcard

Export and import vCards from within GNU Emacs' Org mode.
61 stars 7 forks source link

Requesting needed properties #25

Open technician77 opened 8 years ago

technician77 commented 8 years ago

I need the exporter to support some more properties in order to make it usable for me in a business environment. The properties are CATEGORIES, ROLE, ORG, URL and NOTE . Taken from https://en.wikipedia.org/wiki/VCard#Properties I hope you can find some time to add them.

The idea is to use org-mode to quickly create contacts based on a org-vcard-template and export them as vcard to outlook when needed.

flexibeast commented 8 years ago

i'll try to add them as soon as possible. Thanks for your input!

flexibeast commented 8 years ago

(Actually. the NOTE property should already be available - is it not working for you?)

technician77 commented 8 years ago

Oh, well that's what you get when you do a quick final addition to a post. Yes, sorry, I did test the other properties but not NOTE, just tested it and it works great. But NOTE was added last for a reason - it is not so important as the other, missing properties.

flexibeast commented 8 years ago

nod Understood. As i said, i'll certainly try to add the other properties as soon as i can; but if you're really in a hurry, you could probably at least add the ROLE and URL properties yourself, via visiting the org-vcard customize-group, and inserting new entries in the relevant places of Org Vcard Styles Languages Mappings.

technician77 commented 8 years ago

I tried to add them, VCard 2.1, en language and flat-style is my default. Added ROLE and URL to the corresponding language mappings but for some reason the output did not contain the properties. Somehow I think there needs to done more than just add the properties to the language mappings, but on the other hand I have no idea since I'm not a coder.

flexibeast commented 7 years ago

@technician77:

Support for the CATEGORIES, ORG, ROLE and URL properties has now been added - sorry for the long delay! Could you please install the latest version of org-vcard and let me know if it all works as expected?

technician77 commented 7 years ago

First, thanks for taking time and implementing my request. As said, I test export with outlook (2010). ORG works like intended. I hoped Outlook would support three levels but two is better than nothing. Then I must apologize. I should have conducted more test/research with outlook before requesting. ROLE seems to be ignored by outlook. What I really need is TITLE. Then URL - it seems Outlook seems to separate between URL;HOME and URL;WORK. Clever as a business app that outlook is it puts URL without anything following into URL;HOME. So if you can add a further differentiation like in ADR it would fix that problem. Finally CATEGORIES puzzles me the most. It seems that Outlook is not only ignoring it in an import it also does not export it when I set it in outlook manually. It looks like Outlook handles categories only locally. Well there might be even good reasons for it. Who knows maybe someone has put me in some "Idiot" category inside his outlook. Good thing, that it is stipped of, when forwarding the vcard.

flexibeast commented 7 years ago

You're welcome! Don't worry about having asked for ROLE and CATEGORIES to be implemented even though you're unable to use them yourself - as part of the relevant specs, they needed to be implemented anyway. :-)

i'll add support for TITLE as soon as possible.

The URL issue is a bit more complicated:

Outlook 2010 having URL;HOME and URL;WORK seems like it's working off vCard 2.1.

Thus, here's what i'm planning to do:

Org property vCard property
URL URL
URL_HOME URL;TYPE="home"
URL_HOME URL;TYPE=home
URL_HOME URL;HOME
URL_WORK URL;TYPE="work"
URL_WORK URL;TYPE=work
URL_WORK URL;WORK

Outlook 2010 users such as yourself could then adjust the above as required, e.g. so that Org URL_HOME points to vCard URL.

technician77 commented 7 years ago

Sounds great! Yeah, MS was never good at following standards strictly. I use emacs now for around 10 month. Since using it I really recognized what a slow pain GUIs are. But since Windows and Outlook are very present in the business environment they can not be ignored. Org-vcard can act as a glue between emacs and Outlook regarding contacts.

Regarding the import: You might have a look at the export of a vcard from outlook below. In order to get the vcard imported by org-vcard I have to remove X-MS-OL-DESIGN because it contains "". Is there a way you can make org-vcard handle that? That would avoid manual intervention before importing. Then even when the imports starts some properties get transformed, like TEL;WORK;VOICE becomes LANDLINE_WORK and some get lost like EMAIL;PREF;INTERNET. Transformation would be o.k. if when reexported outlook recognized the transformed properties. But missing properties are problematic.

BEGIN:VCARD
VERSION:2.1
N:Mustermann;Max;;Doktor
FN:Doktor Max Mustermann
ORG:Musterfirma;Musterabteilung
TITLE:Placeholder
TEL;WORK;VOICE:+49 (123) 1234 - 1234
TEL;CELL;VOICE:+49 (123) 12341234
ADR;WORK;PREF:;;;Musterstrasse 2b;;;Deutschland
LABEL;WORK;PREF:Musterstrasse 2b
ADR;HOME:;;;Musterstrasse 1a;;;Deutschland
LABEL;HOME:Musterstrasse 1a
X-MS-OL-DEFAULT-POSTAL-ADDRESS:2
URL;HOME:go.go.test
URL;WORK:bla.bla.internal
EMAIL;PREF;INTERNET:max@mustermann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7VLEP5YoAJmwgHrUa/LGT60sxy+PQUEEqFXk96AIKKmEar9880UAA5OKlQ4X
 jknmkDIei8/SlclUOOKAG+WN2X5J7CmvIRwo28UkfLEnrimuQXNADVG5vmNFJjJwKKALEY+Y
 fnSzHoPxpY1+U/lTHZdx4yenPQUAEYIXPvUeFXqcn0FSOf3fPHAHFRUABc9F+X6UUyigC8eE
 57VXA3MPc1PKcRn3qFOpPoKACQ9PxNR06T72PTim0AMooooAszH5gPSkj+7z3NI5yx+tOPCf
 QfzoAhJyc0UHrRQAyiiigCyH3EAilYrjnuaYnUn0FI/UD0FABsU9P0NIY/f8xTT1oDEdCRQA
 bG7c/Q0Ubz3AP4UUASp91vwprffb60UUAMPWiiigBlFFFAH/2Q==

X-MS-OL-DESIGN;CHARSET=utf-8:<card xmlns="http://schemas.microsoft.com/office/outlook/12/electronicbusinesscards" ver="1.0" layout="left" bgcolor="ffffff"><img xmlns="" align="fit" area="16" use="cardpicture"/><fld xmlns="" prop="name" align="left" dir="ltr" style="b" color="000000" size="10"/><fld xmlns="" prop="org" align="left" dir="ltr" color="000000" size="8"/><fld xmlns="" prop="title" align="left" dir="ltr" color="000000" size="8"/><fld xmlns="" prop="dept" align="left" dir="ltr" color="000000" size="8"/><fld xmlns="" prop="telwork" align="left" dir="ltr" color="000000" size="8"><label align="right" color="626262">Geschäftlich</label></fld><fld xmlns="" prop="telcell" align="left" dir="ltr" color="000000" size="8"><label align="right" color="626262">Mobiltelefon</label></fld><fld xmlns="" prop="email" align="left" dir="ltr" color="000000" size="8"/><fld xmlns="" prop="addrwork" align="left" dir="ltr" color="000000" size="8"/><fld xmlns="" prop="addrhome" align="left" dir="ltr" color="000000" size="8"/><fld xmlns="" prop="webwork" align="left" dir="ltr" color="000000" size="8"/><fld xmlns="" prop="webhome" align="left" dir="ltr" color="000000" size="8"/><fld xmlns="" prop="blank" size="8"/><fld xmlns="" prop="blank" size="8"/><fld xmlns="" prop="blank" size="8"/><fld xmlns="" prop="blank" size="8"/><fld xmlns="" prop="blank" size="8"/></card>
REV:20161010T140545Z
END:VCARD

Import Result:

* Doktor Max Mustermann
:PROPERTIES:
:VERSION: 2.1
:N: Mustermann;Max;;Doktor
:ORG: Musterfirma;Musterabteilung
:LANDLINE_WORK: +49 (123) 1234 - 1234
:CELL: +49 (123) 12341234
:ADDRESS_HOME: ;;;Musterstrasse 1a;;;Deutschland
:END:
flexibeast commented 7 years ago

I have to remove X-MS-OL-DESIGN because it contains "". Is there a way you can make org-vcard handle that?

Do you mean, the import fails because you've set the variable org-vcard-include-import-unknowns to t, but there are double-quotes present in the value of the X-MS-OL-DESIGN property?

some properties get transformed, like TEL;WORK;VOICE becomes LANDLINE_WORK

Yes, that's by design. org-vcard was originally designed to be a way of transferring data between the existing org-contacts format (which i didn't create, and which seems to be in widespread use) and the vCard format. The org-contacts format is fairly simple and limited, and is basically under-specified when it comes to exchanging data with the vCard format.

Given this, i designed org-vcard to allow:

org-vcard already includes different mappings for Australian English and US English, so that in the latter, vCard 2.1 TEL;CELL gets transformed to 'CELL', but in the former, it gets transformed to 'MOBILE'.

Thus, it should be possible to create a vcard style that literally uses vCard properties as Org properties, so that e.g. vCard 2.1 TEL;WORK;VOICE would become the Org property TEL;WORK;VOICE.

some get lost like EMAIL;PREF;INTERNET

Sorry; this is probably the result of PREF not yet being supported for the flat style yet, as i've not yet worked out how to do so. Such support is on the project's TODO list, however.

Transformation would be o.k. if when reexported outlook recognized the transformed properties.

Well, export should reverse the transformation appropriately, so that Outlook can recognise it. Given that the version of Outlook you're using seems to be using the 2.1 spec, are you specifying version 2.1 when you export?

But missing properties are problematic.

Agreed! Unfortunately the three versions of the vCard specification are rather complex, and additionally, each version can have different ways of handling the same issue (example: specifying the character set in use). This makes implementing the full specification of each version quite a task, especially when there's only one person working on it (i.e. myself!), and part-time at that (not least because there are other projects i'm working on as well).

So i encourage people to help out by putting together the mappings and/or styles they need, and submitting them for inclusion in the org-vcard package. :-)

flexibeast commented 6 years ago

i've just released version 0.2.0, which adds support for the CATEGORIES, ORG, ROLE, TITLE and URL properties. As this covers this issue's original request, i'd like to close this issue. Before i do so, however, i'd like to follow up on the two questions i asked in my previous message:

Do you mean, the import fails because you've set the variable org-vcard-include-import-unknowns to t, but there are double-quotes present in the value of the X-MS-OL-DESIGN property?

and

Well, export should reverse the transformation appropriately, so that Outlook can recognise it. Given that the version of Outlook you're using seems to be using the 2.1 spec, are you specifying version 2.1 when you export?

technician77 commented 6 years ago

First, thanks for developing the new version. So since some properties I needed for my intended workflow were missing I abandoned org-vcard. I tried bbdb which seemed to be robust but it was exactly the overkill I thought it would be and which I didn't want. So back to org-vcard 0.2. Tried that, export is now working as I need it. Yes, I specify 2.1. Then I tried import and made some tests why it fails and when it starts working. Import unknown is set to true.

The imports does NOT fail because of the doublequote. The reasons for failure are simpler:

  1. Reason was the blank line between X-MS-CARDPICTURE and X-MS-OL-DESIGN. (Some month ago I thought the error occurs because of the doublequotes, because the error-message I got from org-vcard led me to to belief that)

  2. Reason was

    LABEL;WORK;PREF;ENCODING=QUOTED-PRINTABLE:Teststrasse 1=0D=0A=
    123456 Teststadt

    needed to be turned into: LABEL;WORK;PREF;ENCODING=QUOTED-PRINTABLE:Teststrasse 1=0D=0A=123456 Teststadt

It would be great if you can make org-vcard deal with these format issues that outlook produces. This would allow an import without manually editing the vcf first.

When I fix the import issues by editing the vcf file manually and import is successful, the export of exact that file causes some properties to disapear. At least Email, Url and adress are missing.

On the other hand import is at least for me not that important. My idea was to have a template that I can use to maintain contact information and if needed export to outlook since its contacts are synced to mobile. That is working when using a propper template instead of that cr*p that outlook export produces.

flexibeast commented 6 years ago

thanks for developing the new version.

You're welcome. :-)

So back to org-vcard 0.2. Tried that, export is now working as I need it.

Glad to hear it!

Reason was the blank line between X-MS-CARDPICTURE and X-MS-OL-DESIGN.

According to my reading of the vCard 2.1 spec, such blank lines are not allowed. So this is an issue that needs to be fixed on Outlook's side.

(Some month ago I thought the error occurs because of the doublequotes, because the error-message I got from org-vcard led me to to belief that)

Sorry about that - i'd like a better error message to be reported, if possible. Could you tell me what the exact error message was, please?

Reason was [text] needed to be turned into [text]

Sorry about this also - it's due to me not yet having implemented the relevant part of the spec. i'll try to do so as soon as i can.

When I fix the import issues by editing the vcf file manually and import is successful, the export of exact that file causes some properties to disapear. At least Email, Url and adress are missing.

Hmm, okay. Could you please create an example contact in Outlook, export that contact to VCF, and paste the resulting vCard entry here?

technician77 commented 6 years ago

I tried the export a bit more. There is one thing that is a problem for outlook:

This can be imported by outlook, but is ignored by the org-vcard exporter: :URL;WORK: http://www.mustermann.de This is ignored by outlook import, but can be exported by the org-vcard exporter: :URL: http://www.mustermann.de

Below is an export of an outlook 2010 v-card. What is strange, beside numerous other issues, is that it always contains X-MS-CARDPICTURE even if there is no picture.

BEGIN:VCARD
VERSION:2.1
N:Mustermanna;Max
FN:Max Mustermanna
ORG:Musterfirma;Musterabteilung
TITLE:Adminstrator
NOTE:Bla
TEL;WORK;VOICE:+49 (123) 1234 - 1234
TEL;CELL;VOICE:+49 (123) 12341234
TEL;FAX:+49 (123) 1234 - 4321
ADR;WORK;PREF:;;Musterstrasse 2b;Musterstadt;;9876;Germany
LABEL;WORK;PREF;ENCODING=QUOTED-PRINTABLE:Musterstrasse 2b=0D=0A=
=0D=0A=
9876  Musterstadt
ADR;HOME:;;Musterstrasse 1a;Musterstadt;;1234;Germany
LABEL;HOME;ENCODING=QUOTED-PRINTABLE:Musterstrasse 1a=0D=0A=
=0D=0A=
1234  Musterstadt
X-MS-OL-DEFAULT-POSTAL-ADDRESS:2
URL;WORK:http://www.mustermann.de
EMAIL;PREF;INTERNET:max@mustermann.de
X-MS-CARDPICTURE;TYPE=JPEG;ENCODING=BASE64:
 /9j/4AAQSkZJRgABAQEAYABgAAD/2wBDAAcFBQYFBAcGBQYIBwcIChELCgkJChUPEAwRGBUa
 GRgVGBcbHichGx0lHRcYIi4iJSgpKywrGiAvMy8qMicqKyr/2wBDAQcICAoJChQLCxQqHBgc
 KioqKioqKioqKio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uYe5qeU4jPvUKdSfQUAEh6fiajp0n3senFNoAZRRRQBZmPzAelJH93nuaRzlj9aceE+
 g/nQBCTk5ooPWigBlFFFAFkPuIBFKxXHPc0xOpPoKR+oHoKADYp6foaQx+/5imnrQGI6EigA
 2N25+hoo3nuAfwooAlT7rfhTW++31oooAYetFFFADKKKKAP/2Q==

X-MS-OL-DESIGN;CHARSET=utf-8:<card xmlns="http://schemas.microsoft.com/office/outlook/12/electronicbusinesscards" ver="1.0" layout="left" bgcolor="ffffff"><img xmlns="" align="fit" area="16" use="cardpicture"/><fld xmlns="" prop="name" align="left" dir="ltr" style="b" color="000000" size="10"/><fld xmlns="" prop="org" align="left" dir="ltr" color="000000" size="8"/><fld xmlns="" prop="title" align="left" dir="ltr" color="000000" size="8"/><fld xmlns="" prop="dept" align="left" dir="ltr" color="000000" size="8"/><fld xmlns="" prop="telwork" align="left" dir="ltr" color="000000" size="8"><label align="right" color="626262">Geschäftlich</label></fld><fld xmlns="" prop="telcell" align="left" dir="ltr" color="000000" size="8"><label align="right" color="626262">Mobiltelefon</label></fld><fld xmlns="" prop="email" align="left" dir="ltr" color="000000" size="8"/><fld xmlns="" prop="addrwork" align="left" dir="ltr" color="000000" size="8"/><fld xmlns="" prop="addrhome" align="left" dir="ltr" color="000000" size="8"/><fld xmlns="" prop="webwork" align="left" dir="ltr" color="000000" size="8"/><fld xmlns="" prop="blank" size="8"/><fld xmlns="" prop="blank" size="8"/><fld xmlns="" prop="blank" size="8"/><fld xmlns="" prop="blank" size="8"/><fld xmlns="" prop="blank" size="8"/><fld xmlns="" prop="blank" size="8"/></card>
REV:20170923T061957Z
END:VCARD
flexibeast commented 6 years ago

This can be imported by outlook, but ignored by the org-vcard exporter: :URL;WORK: http://www.mustermann.de This is ignored by outlook import, but can be exported by the org-vcard exporter: :URL: http://www.mustermann.de

The vCard 2.1 spec does not state that the URL property can have the WORK modifier (whereas it does for the TEL property, for example). So this seems to be an Outlook extension. i'll have to think about how to handle this.

Below is an export of an outook v-card.

Great, thanks! Hopefully that will allow me to reproduce the "missing properties on export" issue you're experiencing, and thus work out what's going on.

flexibeast commented 6 years ago

An update: it turns out i've misread the vCard 2.1 spec, and the blank line is not only allowed in that context, but required.

Due to this and the other issues you've mentioned, i've decided to get the bit between the teeth and change how org-vcard parses vCards. There's now a library available for building parsers, parsec.el, which wasn't available when i initially wrote org-vcard in 2014. So instead of the existing ad-hoc parsing, which is going to become increasingly difficult to maintain and extend, i'm going to create a new library, vcard-parser, based on parsec.el, and then have org-vcard use that. That will address a few current issues with org-vcard, including the ones you've encountered.

This is going to be rather a lot of work, but i've already put together most of a vCard 2.1 parser. Once i've created parsers for vCard 3.0 and vCard 4.0, i'll release the vcard-parser library as a separate project, then start modifying org-vcard to use it.

Hopefully all this will result in more of the functionality you'd like from org-vcard. :-)

technician77 commented 6 years ago

Sounds great. I think org-vcard has quite some potential since it's lightweight compared to bbdb. I presume that bbdb is more fitting for people who use emacs also as a mail/pim-client. But for people who are forced to use windows and outlook org-vcard can be a great companion. The only requirement for a fluid workflow between these applications is a robust import and export. Therefore I'm looking forward to these improvements.

girzel commented 6 years ago

Hey I was pointed in the direction of this repo, as I'm currently contemplating adding better vcard support to EBDB (a re-write of BBDB), and am procrastinating. I was looking at the Wisent parser, which comes with CEDET, but perhaps parsec.el is a better choice.

What I'm saying is, please do write this parsing library, and make it end-user agnostic so other people can use it! There are a lot of vcard-related libraries out there, but they're all tied to specific implementations. It would be great to have something generalized, and I'm happy to help.

wi11dey commented 5 years ago

Just tested the problem section in https://github.com/flexibeast/org-vcard/issues/25#issuecomment-331609788 and it is able to be correctly parsed by #30