VCF文件导入导出

参考资料

通讯录导入导出vcf格式文件方法可参考:

https://qiaodahai.com/android-iphone-mobile-phones-contacts-import-and-export.html
vCard维基百科:
https://en.wikipedia.org/wiki/VCard
vCard Format Specification:
https://www.rfc-editor.org/rfc/pdfrfc/rfc6350.txt.pdf

手动导出实例

Android(Android6)系统自带的联系人导出00001.vcf文件实例:

BEGIN:VCARD
VERSION:2.1
N;CHARSET=UTF-8;ENCODING=QUOTED-PRINTABLE:;=E5=BC=A0=E4=B8=89;;;
FN;CHARSET=UTF-8;ENCODING=QUOTED-PRINTABLE:=E5=BC=A0=E4=B8=89
TEL;CELL:15888888888
TEL;CELL:15688888888
EMAIL;HOME:zhangsan@qq.com
END:VCARD
BEGIN:VCARD
VERSION:2.1
N;CHARSET=UTF-8;ENCODING=QUOTED-PRINTABLE:;=E6=9D=8E=E5=9B=9B;;;
FN;CHARSET=UTF-8;ENCODING=QUOTED-PRINTABLE:=E6=9D=8E=E5=9B=9B
TEL;CELL:16666666666
EMAIL;HOME:lisi@gmail.com
END:VCARD

苹果iCloud官网导出的iCloud vCard.vcf文件实例:

BEGIN:VCARD
VERSION:3.0
PRODID:-//Apple Inc.//iOS 10.1.1//EN
N:丁;小丽;;;
FN:丁小丽
TEL;type=CELL;type=VOICE;type=pref:15811111111
REV:2018-02-21T05:34:09Z
END:VCARD
BEGIN:VCARD
VERSION:3.0
PRODID:-//Apple Inc.//iOS 10.1.1//EN
N:;;;;
FN:钉钉专属顾问
ORG:钉钉专属顾问;
item1.TEL;type=pref:057156215888
item1.X-ABLabel:钉钉智能办公电话
REV:2018-02-21T23:01:24Z
END:VCARD

vCard介绍

vCard:又被称为:VCF(Virtual Contact File),是一种电子名片的文件格式标准。vCard可以包含名字,地址,电话,e-mail地址,照片等。

vCard格式规约

Charset : 只能是 UTF-8。
每行长度不超过75字节(不包括换行符),逻辑上长度超过75字节,需要用回车换行符进行对内容进行物理上的折叠。换行后至少空一格,也可以空两格,或空一个tab。如果只空了一格,在展开这行的时候,这个空格要被省去(即去掉<CRLF>和单个空格,对于[RFC5322]有点不同,展开的时候是去掉<CRLF><WSP> )。

vCard定义范式

vcard-entity = 1*vcard
vcard = "BEGIN:VCARD" CRLF
"VERSION:4.0" CRLF
1*contentline
"END:VCARD" CRLF
; A vCard object MUST include the VERSION and FN properties.
; VERSION MUST come immediately after BEGIN:VCARD.

contentline = [group "."] name *(";" param) ":" value CRLF

group = 1*(ALPHA / DIGIT / "-")

name = "SOURCE" / "KIND" / "FN" / "N" / "NICKNAME"
/ "PHOTO" / "BDAY" / "ANNIVERSARY" / "GENDER" / "ADR" / "TEL"
/ "EMAIL" / "IMPP" / "LANG" / "TZ" / "GEO" / "TITLE" / "ROLE"
/ "LOGO" / "ORG" / "MEMBER" / "RELATED" / "CATEGORIES"
/ "NOTE" / "PRODID" / "REV" / "SOUND" / "UID" / "CLIENTPIDMAP"
/ "URL" / "KEY" / "FBURL" / "CALADRURI" / "CALURI" / "XML"
/ iana-token / x-name
; Parsing of the param and value is based on the "name" as
; defined in ABNF sections below.
; Group and name 大小写不敏感.

iana-token = 1*(ALPHA / DIGIT / "-")
; identifier registered with IANA

x-name = "x-" 1*(ALPHA / DIGIT / "-")
; Names that begin with "x-" or "X-" are
; reserved for experimental use, not intended for released
; products, or for use in bilateral agreements.

param = language-param / value-param / pref-param / pid-param
/ type-param / geo-parameter / tz-parameter / sort-as-param
/ calscale-param / any-param
; Allowed parameters depend on property name.

param-value = *SAFE-CHAR / DQUOTE *QSAFE-CHAR DQUOTE

any-param = (iana-token / x-name) "=" param-value *("," param-value)

NON-ASCII = UTF8-2 / UTF8-3 / UTF8-4
; UTF8-{2,3,4} are defined in [RFC3629]

QSAFE-CHAR = WSP / "!" / %x23-7E / NON-ASCII
; Any character except CTLs, DQUOTE

SAFE-CHAR = WSP / "!" / %x23-39 / %x3C-7E / NON-ASCII
; Any character except CTLs, DQUOTE, ";", ":"

VALUE-CHAR = WSP / VCHAR / NON-ASCII
; Any textual character

vCard定义范式说明

Property names and parameter names 大小写不敏感,Parameter values没有显示声明成case-sensitive的大小写不敏感. 为了与vCard 3兼容, 建议property andparameter names用大写。

group仅仅是为了将相近的属性归为一类。

范式中的基数说明:
+-------------+--------------------------------------------------+
| Cardinality | Meaning |
+-------------+--------------------------------------------------+
| 1 | Exactly one instance per vCard MUST be present. |
| *1 | Exactly one instance per vCard MAY be present. |
| 1* | One or more instances per vCard MUST be present. |
| * | One or more instances per vCard MAY be present. |
+-------------+--------------------------------------------------+


属性可能会有多个值,一般来说当出现多个值的情况时,编码规则是新建一个内容行,重复属性名和值。如:
TEL;CELL:18722222222
TEL;CELL:15622222222
但是有些值类型支持用逗号作分隔,比如(date, time, integer, float)

逗号分隔值,分号分隔属性,不是作为分隔符时,需要在前面加反斜杠转义。反斜杠不做为转义符时,前面需要添加反斜杠转义。换行符需要转义:\n 或者 \N

属性值类型:
value = text
/ text-list
/ date-list
/ time-list
/ date-time-list
/ date-and-or-time-list
/ timestamp-list
/ boolean
/ integer-list
/ float-list
/ URI ; from Section 3 of [RFC3986]
/ utc-offset
/ Language-Tag
/ iana-valuespec
; Actual value type depends on property name and VALUE parameter.

text = *TEXT-CHAR

TEXT-CHAR = "\\" / "\," / "\n" / WSP / NON-ASCII
/ %x21-2B / %x2D-5B / %x5D-7E
; Backslashes, commas, and newlines must be encoded.

component = "\\" / "\," / "\;" / "\n" / WSP / NON-ASCII
/ %x21-2B / %x2D-3A / %x3C-5B / %x5D-7E

list-component = component *("," component)

text-list = text *("," text)
date-list = date *("," date)
time-list = time *("," time)
date-time-list = date-time *("," date-time)
date-and-or-time-list = date-and-or-time *("," date-and-or-time)
timestamp-list = timestamp *("," timestamp)
integer-list = integer *("," integer)
float-list = float *("," float)
boolean = "TRUE" / "FALSE"
integer = [sign] 1*DIGIT
float = [sign] 1*DIGIT ["." 1*DIGIT]
sign = "+" / "-"
year = 4DIGIT ; 0000-9999
month = 2DIGIT ; 01-12
day = 2DIGIT ; 01-28/29/30/31 depending on month and leap year
hour = 2DIGIT ; 00-23
minute = 2DIGIT ; 00-59
second = 2DIGIT ; 00-58/59/60 depending on leap second
zone = utc-designator / utc-offset
utc-designator = %x5A ; uppercase "Z"
date = year [month day]
/ year "-" month
/ "--" month [day]
/ "--" "-" day
date-noreduc = year month day
/ "--" month day
/ "--" "-" day
date-complete = year month day
time = hour [minute [second]] [zone]
/ "-" minute [second] [zone]
/ "-" "-" second [zone]
time-notrunc = hour [minute [second]] [zone]
time-complete = hour minute second [zone]

属性可以有多个attribute与之关联,也就是propertyparameters。parameter有多个值时,用逗号分隔。parameter值里有冒号,分号,逗号的需要被引号引起来。

VALUE是可选的parameter,用来指示值的类型和格式。推荐使用。
VALUE范式:
value-param = "VALUE=" value-type
value-type = "text"
/ "uri"
/ "date"
/ "time"
/ "date-time"
/ "date-and-or-time"
/ "timestamp"
/ "boolean"
/ "integer"
/ "float"
/ "utc-offset"
/ "language-tag"
/ iana-token ; registered as described in section 12
/ x-name

PREF代表优先级,必须为1到100间的整数,1优先级最高。

vCard 属性分类

(截取自RFC第六章目录,可以通过后面对应页码查看详情)

6.1. General Properties通用属性
6.1.1. BEGIN . . . . . . . . .开始标志,必须有. . . . . . . . . . . . . .  23
6.1.2. END . . . . . . . . . .结束标志,必须有. . . . . . . . . . . . . . . 23
6.1.3. SOURCE . . . . . . . . .资料来源url,可以从这获取vCard对象的最新状态. . . . . . . . . . . . . 24
6.1.4. KIND . . . . . . . . . .vCard类型('individual, 'group', 'location' or 'organization'). . . . . . . .25
6.1.5. XML . . . . . . . . . .跟该vCard对象相关的XML编码的数据 . . . . . . . . . . . . . . . 27
6.2. Identification Properties身份标识属性
6.2.1. FN . . . . . . . . . . .名字. . . . . . . . . . . . . . . 28
6.2.2. N . . . . . . . . . . .人名,职位及其他与该vCard对象关联的一种结构化的表示,如N:Doe;John;;Dr;. . . . . . . . . . . . . . . 29
6.2.3. NICKNAME . . . . . . . .昵称(多个间用逗号分隔). . . . . . . . . . . . . . . 29
6.2.4. PHOTO . . . . . . . . .照片(*). . . . . . . . . . . . . . . 30
6.2.5. BDAY . . . . . . . . . .出生日期(*1) . . . . . . . . . . . . . . . 30
6.2.6. ANNIVERSARY . . . . . .周年纪念日 (*1). . . . . . . . . . . . . . . 31
6.2.7. GENDER . . . . . . . . .性别(*1)M代表male,F代表female,O代表other,N代表none或者不适用的,U代表未知 . . . . . 32
6.3. Delivery Addressing Properties地址
6.3.1. ADR . . . . . . . . . .地址,由多个属性(街道,区域,国家等)构成,属性间分号分隔,属性值没有时,分号需要保留 . . . .32
6.4. Communications Properties通信属性
6.4.1. TEL . . . . . . . . . .电话 . . . . . . . . . . . . . . . 34
6.4.2. EMAIL . . . . . . . . .邮箱 . . . . . . . . . . . . . . . 36
6.4.3. IMPP . . . . . . . . . .即时通信uri (*)(示例:IMPP;PREF=1:xmpp:alice@example.com). . . . . . . . . . . . . . . 36
6.4.4. LANG . . . . . . . . . .vCard对象使用的语言(*) . . . . . . . . . . . . . . . 37
6.5. Geographical Properties地理属性
6.5.1. TZ . . . . . . . . . . .时区(不建议使用utc-offset) . . . . . . . . . . . . . . . 37
6.5.2. GEO . . . . . . . . . .经纬度 . . . . . . . . . . . . . . . 38
6.6. Organizational Properties组织属性
6.6.1. TITLE . . . . . . . . .职位头衔 . . . . . . . . . . . . . . . 39
6.6.2. ROLE . . . . . . . . . .担任角色 . . . . . . . . . . . . . . . 39
6.6.3. LOGO . . . . . . . . . .logoURI . . . . . . . . . . . . . . . 40
6.6.4. ORG . . . . . . . . . .组织名 . . . . . . . . . . . . . . . 40
6.6.5. MEMBER . . . . . . . . .成员,vCardd类型为"group"时才能使用该属性. . . . . . . . . . . . . . . . 41
6.6.6. RELATED . . . . . . . .vCard对象拥有的关系(同事,配偶等) . . . . . . . . . . . . . . . 42
6.7. Explanatory Properties解释性属性
6.7.1. CATEGORIES . . . . . . .所属分类,标签(例如CATEGORIES:INTERNET,IETF,INDUSTRY,INFORMATION TECHNOLOGY) . .43
6.7.2. NOTE . . . . . . . . . .补充说明信息 . . . . . . . . . . . . . . . 44
6.7.3. PRODID . . . . . . . . .product ID(生产商信息) . . . . . . . . . . . . . . . 44
6.7.4. REV . . . . . . . . . .修订版本号 . . . . . . . . . . . . . . . 45
6.7.5. SOUND . . . . . . . . .(URI)用来表现该vCard对象特定方面特征的声音,常用于存vCard名字的发音 . .  45
6.7.6. UID . . . . . . . . . .全局唯一标识(如UID:urn:uuid:f81d4fae-7dec-11d0-a765-00a0c91e6bf6) . . 46
6.7.7. CLIENTPIDMAP . . . . . .用来给局部资源标识PID一个全局的意义 . . . . . . . . . . . . . . . 47
6.7.8. URL . . . . . . . . . .跟该vCard对象相关的URL地址(博客地址,个人网站地址等) . . . . . . 47
6.7.9. VERSION . . . . . . . .vCard格式版本 . . . . . . . . . . . . . . . 48
6.8. Security Properties安全属性
6.8.1. KEY . . . . . . . . . .(URI)公钥或者认证证书 . . . . . . . . . . . . . . . 48
6.9. Calendar Properties日程表属性
6.9.1. FBURL . . . . . . . . .(URL)标注忙碌(或者空闲)时间表 . . . . . . . . . . . . . . . 49
6.9.2. CALADRURI . . . . . . .日程表可发送地址 . . . . . . . . . . . . . . . 50
6.9.3. CALURI . . . . . . . . .(URI)日程表 . . . . . . . . . . . . . . . 50
6.10. Extended Properties and Parameters扩展属性和参数( "X-"开头的非标准的私有的属性)

属性说明

对于扩展属性,RFC6350是这样说的“Extended Properties and Parameters The properties and parameters defined by this document can be extended. Non-standard, private properties and parameters with a name starting with "X-" may be defined bilaterally between two cooperating agents without outside registration or standardization.”,可以通过定义名称以 "X-"为前缀的属性和参数来扩展上面未定义的。使用和解析的时候达成一致就好。

对于上面定义了的属性,标注为蓝色部分的为和RFC2426兼容部分,其他为新增部分,具体版本的属性差异可以参考vCard维基百科给出的properties对比:

vCard defines the following property types.

All vCards begin with BEGIN:VCARD and end with END:VCARD. All vCards must contain the VERSION property, which specifies the vCard version. VERSIONmust come immediately after BEGIN, except in the vCard 2.1 standard, which allows it to be anywhere in the vCard. Otherwise, properties can be defined in any order.

R = requiredS = supportedSP = special, supportedNS = no longer supported as a property but can be used as a parameter inside another property

NameVersionsDescriptionExample
2.13.04.0
XML  SAny XML data that is attached to the vCard. This is used if the vCard was encoded in XML (xCard standard) and the XML document contained elements which are not part of the xCard standard.XML:<b>Not an xCard XML element</b>
VERSIONRRRThe version of the vCard specification. In versions 3.0 and 4.0, this must come right after the BEGIN property.VERSION:3.0
URLSSSA URL pointing to a website that represents the person in some way.URL:http://www.johndoe.com
UIDSSSSpecifies a value that represents a persistent, globally unique identifier associated with the object.UID:urn:uuid:da418720-3754-4631-a169-db89a02b831b
TZSSSThe time zone of the vCard object.2.13.0TZ:-0500
4.0TZ:America/New_York
TITLESSSSpecifies the job title, functional position or function of the individual associated with the vCard object within an organization.TITLE:V.P. Research and Development
TELSSSThe canonical number string for a telephone number for telephony communication with the vCard object.TEL;TYPE=cell:(123) 555-5832
SOURCESSSA URL that can be used to get the latest version of this vCard.SOURCE:http://johndoe.com/vcard.vcf
SOUNDSSSBy default, if this property is not grouped with other properties it specifies the pronunciation of the FN property of the vCard object. It may point to an external URL or may be embedded in the vCard as a Base64 encoded block of text.2.1SOUND;OGG:http://example.com/sound.ogg
2.1SOUND;OGG;ENCODING=BASE64:[base64-data]
3.0SOUND;TYPE=OGG:http://example.com/sound.ogg
3.0SOUND;TYPE=OGG;ENCODING=b:[base64-data]
4.0SOUND;MEDIATYPE=audio/ogg:http://example.com/sound.ogg
4.0SOUND:data:audio/ogg;base64,[base64-data]
SORT-STRINGSSNS*Defines a string that should be used when an application sorts this vCard in some way.

* Not supported in version 4.0. Instead, this information is stored in the SORT-AS parameter of the N and/or ORG properties.
SORT-STRING:Doe
ROLESSSThe role, occupation, or business category of the vCard object within an organization.ROLE:Executive
REVSSSA timestamp for the last time the vCard was updated.REV:20121201T134211Z
RELATED  SAnother entity that the person is related to. Acceptable values include:
  • a "mailto:" URL containing an email address
  • a UID which references the person's own vCard
RELATED;TYPE=friend:urn:uuid:03a0e51f-d1aa-4385-8a53-e29025acd8af
PROFILESS States that the vCard is a vCard.PROFILE:VCARD
PRODID SSThe identifier for the product that created the vCard object.PRODID:-//ONLINE DIRECTORY//NONSGML Version 1//EN
PHOTOSSSAn image or photograph of the individual associated with the vCard. It may point to an external URL or may be embedded in the vCard as a Base64 encoded block of text.2.1PHOTO;JPEG:http://example.com/photo.jpg
2.1PHOTO;JPEG;ENCODING=BASE64:[base64-data]
3.0PHOTO;TYPE=JPEG;VALUE=URI:http://example.com/photo.jpg
3.0PHOTO;TYPE=JPEG;ENCODING=b:[base64-data]
4.0PHOTO;MEDIATYPE=image/jpeg:http://example.com/photo.jpg
4.0PHOTO:data:image/jpeg;base64,[base64-data]
ORGSSSThe name and optionally the unit(s) of the organization associated with the vCard object. This property is based on the X.520 Organization Name attribute and the X.520 Organization Unit attribute.ORG:Google;GMail Team;Spam Detection Squad
NOTESSSSpecifies supplemental information or a comment that is associated with the vCard.NOTE:I am proficient in Tiger-Crane Style,\nand I am more than proficient in the exquisite art of the Samurai sword.
NICKNAME SSOne or more descriptive/familiar names for the object represented by this vCard.NICKNAME:Jon,Johnny
NAME S Provides a textual representation of the SOURCE property. 
NRRSA structured representation of the name of the person, place or thing associated with the vCard object.N:Doe;John;;Dr;
MEMBER  SDefines a member that is part of the group that this vCard represents. Acceptable values include:
  • a "mailto:" URL containing an email address
  • a UID which references the member's own vCard
The KIND property must be set to "group" in order to use this property.
MEMBER:urn:uuid:03a0e51f-d1aa-4385-8a53-e29025acd8af
MAILERSS Type of email program used.MAILER:Thunderbird
LOGOSSSAn image or graphic of the logo of the organization that is associated with the individual to which the vCard belongs. It may point to an external URL or may be embedded in the vCard as a Base64 encoded block of text.2.1LOGO;PNG:http://example.com/logo.png
2.1LOGO;PNG;ENCODING=BASE64:[base64-data]
3.0LOGO;TYPE=PNG:http://example.com/logo.png
3.0LOGO;TYPE=PNG;ENCODING=b:[base64-data]
4.0LOGO;MEDIATYPE=image/png:http://example.com/logo.png
4.0LOGO:data:image/png;base64,[base64-data]
LANG  SDefines a language that the person speaks.LANG:fr-CA
LABELSSNS*Represents the actual text that should be put on the mailing label when delivering a physical package to the person/object associated with the vCard (related to the ADR property).

* Not supported in version 4.0. Instead, this information is stored in the LABEL parameter of the ADR property. Example: ADR;TYPE=home;LABEL="123 Main St\nNew York, NY 12345":;;123 Main St;New York;NY;12345;USA
LABEL;TYPE=HOME:123 Main St.\nSpringfield, IL 12345\nUSA
KIND  SDefines the type of entity that this vCard represents: 'application', 'individual, 'group', 'location' or 'organization'; 'x-*' values may be used for experimental purposes.[4][5]KIND:individual
KEYSSSThe public encryption key associated with the vCard object. It may point to an external URL, may be plain text, or may be embedded in the vCard as a Base64 encoded block of text.2.1KEY;PGP:http://example.com/key.pgp
2.1KEY;PGP;ENCODING=BASE64:[base64-data]
3.0KEY;TYPE=PGP:http://example.com/key.pgp
3.0KEY;TYPE=PGP;ENCODING=b:[base64-data]
4.0KEY;MEDIATYPE=application/pgp-keys:http://example.com/key.pgp
4.0KEY:data:application/pgp-keys;base64,[base64-data]
IMPP SP*SDefines an instant messenger handle.

* This property was introduced in a separate RFC when the latest vCard version was 3.0. Therefore, 3.0 vCards may use this property, even though it's not part of the 3.0 specifications.
IMPP:aim:johndoe@aol.com
GEOSSSSpecifies a latitude and longitude.2.13.0GEO:39.95;-75.1667
4.0GEO:geo:39.95,-75.1667
GENDER  SDefines the person's gender.GENDER:F
FNSRRThe formatted name string associated with the vCard object.FN:Dr. John Doe
FBURL  SDefines a URL that shows when the person is "free" or "busy" on their calendar.FBURL:http://example.com/fb/jdoe
ENDRRRAll vCards must end with this property.END:VCARD
EMAILSSSThe address for electronic mail communication with the vCard object.EMAIL:johndoe@hotmail.com
CLIENTPIDMAP  SUsed for synchronizing different revisions of the same vCard.CLIENTPIDMAP:1;urn:uuid:3df403f4-5924-4bb7-b077-3c711d9eb34b
CLASS S Describes the sensitivity of the information in the vCard.CLASS:public
CATEGORIESSSSA list of "tags" that can be used to describe the object represented by this vCard.CATEGORIES:swimmer,biker
CALURI  SA URL to the person's calendar.CALURI:http://example.com/calendar/jdoe
CALADRURI  SA URL to use for sending a scheduling request to the person's calendar.CALADRURI:http://example.com/calendar/jdoe
BEGINRRRAll vCards must start with this property.BEGIN:VCARD
BDAYSSSDate of birth of the individual associated with the vCard.BDAY:19700310
ANNIVERSARY  SDefines the person's anniversary.ANNIVERSARY:19901021
AGENTSS Information about another person who will act on behalf of the vCard object. Typically this would be an area administrator, assistant, or secretary for the individual. Can be either a URL or an embedded vCard.AGENT:http://mi6.gov.uk/007
ADRSSSA structured representation of the physical delivery address for the vCard object.ADR;TYPE=home:;;123 Main St.;Springfield;IL;12345;USA

A handful of separate specifications define additional vCard properties.

NameSpecificationDescriptionExample
BIRTHPLACERFC 6474The location of the individual's birth.BIRTHPLACE;VALUE=text:Maida Vale\, London\, England
DEATHDATERFC 6474The individual's time of death.DEATHDATE:19540607
DEATHPLACERFC 6474The location of the individual death.DEATHPLACE;VALUE=uri:geo:53.328,-2.229409
EXPERTISERFC 6715A professional subject area that the person has knowledge of.EXPERTISE;LEVEL=expert:Computer Science
HOBBYRFC 6715A recreational activity that the person actively engages in.HOBBY;LEVEL=high:knitting
IMPPRFC 4770Defines an instant messenger handle. This was added to the official vCard specification in version 4.0.IMPP:aim:johndoe@aol.com
INTERESTRFC 6715A recreational activity that the person is interested in, but does not necessarily take part in.INTEREST;LEVEL=high:baseball
ORG-DIRECTORYRFC 6715A URI representing the person's work place, which can be used to look up information on the person's co-workers.ORG-DIRECTORY:http://www.company.com/employees

vCard extensions

vCard supports private extensions, with an "X-" prefix, a number of which are in common usage.[citation needed]

Some of these include:

ExtensionUsed AsDataSemantic
Extensions supported by several different programs.
X-ABUIDpropertystringApple Address Book UUID for that entry
X-ANNIVERSARYpropertyYYYY-MM-DDarbitrary anniversary (in addition to BDAY, birthday)
X-ASSISTANTpropertystringassistant name (instead of AGENT)
X-MANAGERpropertystringmanager name
X-SPOUSEpropertystringspouse name
X-GENDERpropertystringvalue Male or Female
X-WAB-GENDERproperty1/2value 1 for female or 2 for male
X-AIMpropertystringInstant Messaging (IM) contact information; TYPE parameter as for TEL
X-ICQpropertystring
X-GOOGLE-TALKX-GTALKpropertystring
X-JABBERpropertystring
X-MSNpropertystring
X-YAHOOpropertystring
X-TWITTERpropertystring
X-SKYPEX-SKYPE-USERNAMEpropertystring
X-GADUGADUpropertystring
X-GROUPWISEpropertystring 
X-MS-IMADDRESSpropertystringIM address in VCF attachment from Outlook (right click Contact, Send Full Contact, Internet Format.)
X-MS-CARDPICTUREpropertystringWorks as PHOTO or LOGO. Contains an image of the Card in Outlook.
X-MS-OL-DESIGNpropertystringContains XML used by Outlook describing the layout of the information presented as a business card.[6]
X-PHONETIC-FIRST-NAMEX-PHONETIC-LAST-NAMEpropertystringalternative spellings, for assisting with the pronunciation of unfamiliar names
Introduced and used by Mozilla; used by Evolution (software)
X-MOZILLA-HTMLpropertyTRUE/FALSEmail recipient prefers HTML-formatted email
X-MOZILLA-PROPERTYpropertystringThunderbird specific settings
Introduced and used by Evolution (software)
X-EVOLUTION-ANNIVERSARYpropertyYYYY-MM-DDarbitrary anniversary (in addition to BDAY, birthday)
X-EVOLUTION-ASSISTANTpropertystringassistant name (instead of Agent)
X-EVOLUTION-BLOG-URLpropertystring/URLblog URL
X-EVOLUTION-FILE-ASpropertystringfile under different name (in addition to N, name components; and FN, full name)
X-EVOLUTION-LISTpropertyTRUE/FALSEentry defines a mailing list (e.g. X-EVOLUTION-LIST:TRUE)
X-EVOLUTION-LIST-SHOW_ADDRESSESpropertyTRUE/FALSEsets whether individual addresses will appear in e-mails sent using a mailing list (e.g. X-EVOLUTION-LIST-SHOW_ADDRESSES:FALSE)
X-EVOLUTION-MANAGERpropertystringmanager name
X-EVOLUTION-SPOUSEpropertystringspouse name
X-EVOLUTION-VIDEO-URLpropertystring/URLvideo chat address
X-EVOLUTION-CALLBACKTEL TYPEparameter value-callback phone number
X-EVOLUTION-RADIOTEL TYPEparameter value-radio contact information
X-EVOLUTION-TELEXTEL TYPEparameter value-Telex contact information
X-EVOLUTION-TTYTDDTEL TYPEparameter value-TTY TDD contact information
Introduced and used by Kontact and KAddressBook
X-KADDRESSBOOK-BlogFeedpropertystring/URLblog URL
X-KADDRESSBOOK-X-AnniversarypropertyISO datearbitrary anniversary, in addition to BDAY = birthday
X-KADDRESSBOOK-X-AssistantsNamepropertystringassistant name (instead of Agent)
X-KADDRESSBOOK-X-IMAddresspropertystringim address
X-KADDRESSBOOK-X-ManagersNamepropertystringmanager name
X-KADDRESSBOOK-X-Officepropertystringoffice description
X-KADDRESSBOOK-X-Professionpropertystringprofession
X-KADDRESSBOOK-X-SpouseNamepropertystringspouse name
X-KADDRESSBOOK-OPENPGPFPpropertystringOpenPGG fingerprint (RFC 6350 standardised KEY as a replacement for this)
Introduced and used by WebMoney
X-WEBMONEY-IDpropertylongUnique 12-Digit number, which is the address of a member within the WebMoneysystem

可行的开源解析工具(基于RFC2426做的实现)

https://github.com/george-haddad/cardme

这个开源工具抽象了一个vCard接口,通过这个接口可以获取和设置RFC2426里规定的不同的Type(对应RFC6350里的Property,也就是vCard里的TEL电话等属性,RFC2426和RFC6350差异可以参看https://tools.ietf.org/html/rfc6350#appendix-A和上面的属性对比表格)。

 

项目中与之相关需求实现思考

因为上面给出的开源工具就RFC2426给出了实现,而RFC2426和RFC6350重合的属性很多,这些重合属性也覆盖了现实生活中通讯录需要使用到的大部分常用属性。所以,建议数据库里存取的时候,字段与这些重合属性对应。在使用该工具解析完了后,再使用我们自己写的DAO来存到对应数据库表字段里。另外剩下的一些有差异的属性,可以视情况不用或者直接去掉。根据项目客户需要,还可以加上必要的其他属性,这些属性以“X-”开头的扩展属性形式存在,在开源工具基础上,新增扩展属性对应的解析方法,数据库表字段里,同样新增对应的扩展字段。

 

转载于:https://www.cnblogs.com/goingforward/p/8665333.html

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值