1e41f4b71Sopenharmony_ci# @ohos.telephony.vcard (VCard) (System API) 2e41f4b71Sopenharmony_ci 3e41f4b71Sopenharmony_ciVCard is a file format standard for electronic business cards. It contains information such as names, addresses, phone numbers, URLs, logos, and photos. The VCard module provides the VCard management functions, including importing VCard files to the contact database and exporting contact data to VCard files. 4e41f4b71Sopenharmony_ci 5e41f4b71Sopenharmony_ci>**NOTE** 6e41f4b71Sopenharmony_ci> 7e41f4b71Sopenharmony_ci>The initial APIs of this module are supported since API version 11. Newly added APIs will be marked with a superscript to indicate their earliest API version.<br> 8e41f4b71Sopenharmony_ci>The APIs provided by this module are system APIs. 9e41f4b71Sopenharmony_ci 10e41f4b71Sopenharmony_ci## Modules to Import 11e41f4b71Sopenharmony_ci 12e41f4b71Sopenharmony_ci```ts 13e41f4b71Sopenharmony_ciimport { vcard } from '@kit.TelephonyKit'; 14e41f4b71Sopenharmony_ci``` 15e41f4b71Sopenharmony_ci 16e41f4b71Sopenharmony_ci## vcard.importVCard<sup>11+</sup> 17e41f4b71Sopenharmony_ci 18e41f4b71Sopenharmony_ciimportVCard\(context: Context, filePath: string, callback: AsyncCallback\<void\>\): void 19e41f4b71Sopenharmony_ci 20e41f4b71Sopenharmony_ciImports a VCard file (that is, **.vcf** file) to the contact database. This API uses an asynchronous callback to return the result. 21e41f4b71Sopenharmony_ci 22e41f4b71Sopenharmony_ci**Required permissions**: ohos.permission.WRITE_CONTACTS and ohos.permission.READ_CONTACTS 23e41f4b71Sopenharmony_ci 24e41f4b71Sopenharmony_ci**System API**: This is a system API. 25e41f4b71Sopenharmony_ci 26e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Telephony.CoreService 27e41f4b71Sopenharmony_ci 28e41f4b71Sopenharmony_ci**Parameters** 29e41f4b71Sopenharmony_ci 30e41f4b71Sopenharmony_ci| Name | Type | Mandatory| Description | 31e41f4b71Sopenharmony_ci| -------- | --------------------------- | ---- | -------------------------------------- | 32e41f4b71Sopenharmony_ci| context | Context | Yes | Application context.| 33e41f4b71Sopenharmony_ci| filePath | string | Yes | Address of the **.vcf** file.| 34e41f4b71Sopenharmony_ci| callback | AsyncCallback<void> | Yes | Callback used to return the result. | 35e41f4b71Sopenharmony_ci 36e41f4b71Sopenharmony_ci**Error codes** 37e41f4b71Sopenharmony_ci 38e41f4b71Sopenharmony_ciFor details about the error codes, see [ohos.telephony (Telephony) Error Codes](errorcode-telephony.md). 39e41f4b71Sopenharmony_ci 40e41f4b71Sopenharmony_ci| ID| Error Message | 41e41f4b71Sopenharmony_ci| -------- | -------------------------------------------- | 42e41f4b71Sopenharmony_ci| 201 | Permission denied. | 43e41f4b71Sopenharmony_ci| 202 | Non-system applications use system APIs. | 44e41f4b71Sopenharmony_ci| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. | 45e41f4b71Sopenharmony_ci| 8300001 | Invalid parameter value. | 46e41f4b71Sopenharmony_ci| 8300003 | System internal error. | 47e41f4b71Sopenharmony_ci| 8300999 | Unknown error. | 48e41f4b71Sopenharmony_ci 49e41f4b71Sopenharmony_ci**Example** 50e41f4b71Sopenharmony_ci 51e41f4b71Sopenharmony_ci```ts 52e41f4b71Sopenharmony_ciimport { window } from '@kit.ArkUI'; 53e41f4b71Sopenharmony_ciimport { UIAbility } from '@kit.AbilityKit'; 54e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit'; 55e41f4b71Sopenharmony_ciimport { vcard } from '@kit.TelephonyKit'; 56e41f4b71Sopenharmony_ci 57e41f4b71Sopenharmony_ciclass EntryAbility extends UIAbility { 58e41f4b71Sopenharmony_ci onWindowStageCreate(windowStage: window.WindowStage) { 59e41f4b71Sopenharmony_ci let filePath: string = "/data/storage/vcf/contacts.vcf"; 60e41f4b71Sopenharmony_ci vcard.importVCard(this.context, filePath, (err: BusinessError) => { 61e41f4b71Sopenharmony_ci console.log(`callback: err->${JSON.stringify(err)}`); 62e41f4b71Sopenharmony_ci }); 63e41f4b71Sopenharmony_ci } 64e41f4b71Sopenharmony_ci} 65e41f4b71Sopenharmony_ci 66e41f4b71Sopenharmony_ci``` 67e41f4b71Sopenharmony_ci 68e41f4b71Sopenharmony_ci## vcard.importVCard<sup>11+</sup> 69e41f4b71Sopenharmony_ci 70e41f4b71Sopenharmony_ciimportVCard\(context: Context,filePath: string, accountId: number, callback: AsyncCallback\<void\>\): void 71e41f4b71Sopenharmony_ci 72e41f4b71Sopenharmony_ciImports a VCard file (that is, **.vcf** file) to the contact database. This API uses an asynchronous callback to return the result. 73e41f4b71Sopenharmony_ci 74e41f4b71Sopenharmony_ci**Required permissions**: ohos.permission.WRITE_CONTACTS and ohos.permission.READ_CONTACTS 75e41f4b71Sopenharmony_ci 76e41f4b71Sopenharmony_ci**System API**: This is a system API. 77e41f4b71Sopenharmony_ci 78e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Telephony.CoreService 79e41f4b71Sopenharmony_ci 80e41f4b71Sopenharmony_ci**Parameters** 81e41f4b71Sopenharmony_ci 82e41f4b71Sopenharmony_ci| Name | Type | Mandatory| Description | 83e41f4b71Sopenharmony_ci| -------- | --------------------------- | ---- | -------------------------------------- | 84e41f4b71Sopenharmony_ci| context | Context | Yes | Application context.| 85e41f4b71Sopenharmony_ci| filePath | string | Yes | Address of the **.vcf** file.| 86e41f4b71Sopenharmony_ci| accountId | number | Yes | Contact account ID.| 87e41f4b71Sopenharmony_ci| callback | AsyncCallback<void> | Yes | Callback used to return the result. | 88e41f4b71Sopenharmony_ci 89e41f4b71Sopenharmony_ci**Error codes** 90e41f4b71Sopenharmony_ci 91e41f4b71Sopenharmony_ciFor details about the error codes, see [ohos.telephony (Telephony) Error Codes](errorcode-telephony.md). 92e41f4b71Sopenharmony_ci 93e41f4b71Sopenharmony_ci| ID| Error Message | 94e41f4b71Sopenharmony_ci| -------- | -------------------------------------------- | 95e41f4b71Sopenharmony_ci| 201 | Permission denied. | 96e41f4b71Sopenharmony_ci| 202 | Non-system applications use system APIs. | 97e41f4b71Sopenharmony_ci| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. | 98e41f4b71Sopenharmony_ci| 8300001 | Invalid parameter value. | 99e41f4b71Sopenharmony_ci| 8300003 | System internal error. | 100e41f4b71Sopenharmony_ci| 8300999 | Unknown error. | 101e41f4b71Sopenharmony_ci 102e41f4b71Sopenharmony_ci**Example** 103e41f4b71Sopenharmony_ci 104e41f4b71Sopenharmony_ci```ts 105e41f4b71Sopenharmony_ciimport { window } from '@kit.ArkUI'; 106e41f4b71Sopenharmony_ciimport { UIAbility } from '@kit.AbilityKit'; 107e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit'; 108e41f4b71Sopenharmony_ciimport { vcard } from '@kit.TelephonyKit'; 109e41f4b71Sopenharmony_ci 110e41f4b71Sopenharmony_ciclass EntryAbility extends UIAbility { 111e41f4b71Sopenharmony_ci onWindowStageCreate(windowStage: window.WindowStage) { 112e41f4b71Sopenharmony_ci let filePath: string = "/data/storage/vcf/contacts.vcf"; 113e41f4b71Sopenharmony_ci let accountId: number = 0; 114e41f4b71Sopenharmony_ci vcard.importVCard(this.context, filePath, accountId, (err: BusinessError) => { 115e41f4b71Sopenharmony_ci console.log(`callback: err->${JSON.stringify(err)}`); 116e41f4b71Sopenharmony_ci }); 117e41f4b71Sopenharmony_ci } 118e41f4b71Sopenharmony_ci} 119e41f4b71Sopenharmony_ci 120e41f4b71Sopenharmony_ci``` 121e41f4b71Sopenharmony_ci 122e41f4b71Sopenharmony_ci## vcard.importVCard<sup>11+</sup> 123e41f4b71Sopenharmony_ci 124e41f4b71Sopenharmony_ciimportVCard\(context: Context, filePath: string, accountId?: number\): Promise\<void\> 125e41f4b71Sopenharmony_ci 126e41f4b71Sopenharmony_ciImports a VCard file (that is, **.vcf** file) to the contact database. This API uses a promise to return the result. 127e41f4b71Sopenharmony_ci 128e41f4b71Sopenharmony_ci**Required permissions**: ohos.permission.WRITE_CONTACTS and ohos.permission.READ_CONTACTS 129e41f4b71Sopenharmony_ci 130e41f4b71Sopenharmony_ci**System API**: This is a system API. 131e41f4b71Sopenharmony_ci 132e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Telephony.CoreService 133e41f4b71Sopenharmony_ci 134e41f4b71Sopenharmony_ci**Parameters** 135e41f4b71Sopenharmony_ci 136e41f4b71Sopenharmony_ci| Name| Type | Mandatory| Description | 137e41f4b71Sopenharmony_ci| ------ | ------ | ---- | -------------------------------------- | 138e41f4b71Sopenharmony_ci| context | Context | Yes | Application context.| 139e41f4b71Sopenharmony_ci| filePath | string | Yes | Address of the **.vcf** file.| 140e41f4b71Sopenharmony_ci| accountId | number | No | Contact account ID.| 141e41f4b71Sopenharmony_ci 142e41f4b71Sopenharmony_ci**Return value** 143e41f4b71Sopenharmony_ci 144e41f4b71Sopenharmony_ci| Type | Description | 145e41f4b71Sopenharmony_ci| --------------- | ------------------------------- | 146e41f4b71Sopenharmony_ci| Promise\<void\> | Promise used to return the result.| 147e41f4b71Sopenharmony_ci 148e41f4b71Sopenharmony_ci**Error codes** 149e41f4b71Sopenharmony_ci 150e41f4b71Sopenharmony_ciFor details about the error codes, see [ohos.telephony (Telephony) Error Codes](errorcode-telephony.md). 151e41f4b71Sopenharmony_ci 152e41f4b71Sopenharmony_ci| ID| Error Message | 153e41f4b71Sopenharmony_ci| -------- | -------------------------------------------- | 154e41f4b71Sopenharmony_ci| 201 | Permission denied. | 155e41f4b71Sopenharmony_ci| 202 | Non-system applications use system APIs. | 156e41f4b71Sopenharmony_ci| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. | 157e41f4b71Sopenharmony_ci| 8300001 | Invalid parameter value. | 158e41f4b71Sopenharmony_ci| 8300003 | System internal error. | 159e41f4b71Sopenharmony_ci| 8300999 | Unknown error. | 160e41f4b71Sopenharmony_ci 161e41f4b71Sopenharmony_ci**Example** 162e41f4b71Sopenharmony_ci 163e41f4b71Sopenharmony_ci```ts 164e41f4b71Sopenharmony_ciimport { window } from '@kit.ArkUI'; 165e41f4b71Sopenharmony_ciimport { UIAbility } from '@kit.AbilityKit'; 166e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit'; 167e41f4b71Sopenharmony_ciimport { vcard } from '@kit.TelephonyKit'; 168e41f4b71Sopenharmony_ci 169e41f4b71Sopenharmony_ciclass EntryAbility extends UIAbility { 170e41f4b71Sopenharmony_ci onWindowStageCreate(windowStage: window.WindowStage) { 171e41f4b71Sopenharmony_ci let filePath: string = "/data/storage/vcf/contacts.vcf"; 172e41f4b71Sopenharmony_ci let accountId: number = 0; 173e41f4b71Sopenharmony_ci vcard.importVCard(this.context, filePath, accountId).then(() => { 174e41f4b71Sopenharmony_ci console.log(`importVCard success.`); 175e41f4b71Sopenharmony_ci }).catch((err: BusinessError) => { 176e41f4b71Sopenharmony_ci console.log(`importVCard failed, promise: err->${JSON.stringify(err)}`); 177e41f4b71Sopenharmony_ci }); 178e41f4b71Sopenharmony_ci } 179e41f4b71Sopenharmony_ci} 180e41f4b71Sopenharmony_ci``` 181e41f4b71Sopenharmony_ci 182e41f4b71Sopenharmony_ci## vcard.exportVCard<sup>11+</sup> 183e41f4b71Sopenharmony_ci 184e41f4b71Sopenharmony_ciexportVCard\(context: Context, predicates: dataSharePredicates.DataSharePredicates, callback: AsyncCallback\<string\>\): void 185e41f4b71Sopenharmony_ci 186e41f4b71Sopenharmony_ciExports contacts to a **.vcf** file. This API uses an asynchronous callback to return the result. 187e41f4b71Sopenharmony_ci 188e41f4b71Sopenharmony_ci**Required permissions**: ohos.permission.WRITE_CONTACTS and ohos.permission.READ_CONTACTS 189e41f4b71Sopenharmony_ci 190e41f4b71Sopenharmony_ci**System API**: This is a system API. 191e41f4b71Sopenharmony_ci 192e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Telephony.CoreService 193e41f4b71Sopenharmony_ci 194e41f4b71Sopenharmony_ci**Parameters** 195e41f4b71Sopenharmony_ci 196e41f4b71Sopenharmony_ci| Name | Type | Mandatory| Description | 197e41f4b71Sopenharmony_ci| -------- | --------------------------- | ---- | -------------------------------------- | 198e41f4b71Sopenharmony_ci| context | Context | Yes | Application context.| 199e41f4b71Sopenharmony_ci| predicates | dataSharePredicates.DataSharePredicates | Yes | Query statement.| 200e41f4b71Sopenharmony_ci| callback | AsyncCallback<string> | Yes | Callback used to return the result, which is the address of the **.vcf** file. | 201e41f4b71Sopenharmony_ci 202e41f4b71Sopenharmony_ci**Error codes** 203e41f4b71Sopenharmony_ci 204e41f4b71Sopenharmony_ciFor details about the error codes, see [ohos.telephony (Telephony) Error Codes](errorcode-telephony.md). 205e41f4b71Sopenharmony_ci 206e41f4b71Sopenharmony_ci| ID| Error Message | 207e41f4b71Sopenharmony_ci| -------- | -------------------------------------------- | 208e41f4b71Sopenharmony_ci| 201 | Permission denied. | 209e41f4b71Sopenharmony_ci| 202 | Non-system applications use system APIs. | 210e41f4b71Sopenharmony_ci| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. | 211e41f4b71Sopenharmony_ci| 8300001 | Invalid parameter value. | 212e41f4b71Sopenharmony_ci| 8300003 | System internal error. | 213e41f4b71Sopenharmony_ci| 8300999 | Unknown error. | 214e41f4b71Sopenharmony_ci 215e41f4b71Sopenharmony_ci**Example** 216e41f4b71Sopenharmony_ci 217e41f4b71Sopenharmony_ci```ts 218e41f4b71Sopenharmony_ciimport { window } from '@kit.ArkUI'; 219e41f4b71Sopenharmony_ciimport { UIAbility } from '@kit.AbilityKit'; 220e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit'; 221e41f4b71Sopenharmony_ciimport { vcard } from '@kit.TelephonyKit'; 222e41f4b71Sopenharmony_ciimport { dataSharePredicates } from '@kit.ArkData'; 223e41f4b71Sopenharmony_ci 224e41f4b71Sopenharmony_ciclass EntryAbility extends UIAbility { 225e41f4b71Sopenharmony_ci onWindowStageCreate(windowStage: window.WindowStage) { 226e41f4b71Sopenharmony_ci let predicates = new dataSharePredicates.DataSharePredicates(); 227e41f4b71Sopenharmony_ci predicates.equalTo("NAME", "Rose"); 228e41f4b71Sopenharmony_ci 229e41f4b71Sopenharmony_ci vcard.exportVCard(this.context, predicates, (err: BusinessError, data: string) => { 230e41f4b71Sopenharmony_ci console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); 231e41f4b71Sopenharmony_ci }); 232e41f4b71Sopenharmony_ci } 233e41f4b71Sopenharmony_ci} 234e41f4b71Sopenharmony_ci 235e41f4b71Sopenharmony_ci``` 236e41f4b71Sopenharmony_ci 237e41f4b71Sopenharmony_ci## vcard.exportVCard<sup>11+</sup> 238e41f4b71Sopenharmony_ci 239e41f4b71Sopenharmony_ciexportVCard\(context: Context, predicates: dataSharePredicates.DataSharePredicates, options: VCardBuilderOptions, callback: AsyncCallback\<string\>\): void 240e41f4b71Sopenharmony_ci 241e41f4b71Sopenharmony_ciExports contacts to a **.vcf** file. This API uses an asynchronous callback to return the result. 242e41f4b71Sopenharmony_ci 243e41f4b71Sopenharmony_ci**Required permissions**: ohos.permission.WRITE_CONTACTS and ohos.permission.READ_CONTACTS 244e41f4b71Sopenharmony_ci 245e41f4b71Sopenharmony_ci**System API**: This is a system API. 246e41f4b71Sopenharmony_ci 247e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Telephony.CoreService 248e41f4b71Sopenharmony_ci 249e41f4b71Sopenharmony_ci**Parameters** 250e41f4b71Sopenharmony_ci 251e41f4b71Sopenharmony_ci| Name | Type | Mandatory| Description | 252e41f4b71Sopenharmony_ci| -------- | --------------------------- | ---- | -------------------------------------- | 253e41f4b71Sopenharmony_ci| context | Context | Yes | Application context.| 254e41f4b71Sopenharmony_ci| predicates | dataSharePredicates.DataSharePredicates | Yes | Query statement.| 255e41f4b71Sopenharmony_ci| options | [VCardBuilderOptions](#vcardbuilderoptions11) | Yes | VCard version and encoding type.| 256e41f4b71Sopenharmony_ci| callback | AsyncCallback<string> | Yes | Callback used to return the result, which is the address of the **.vcf** file. | 257e41f4b71Sopenharmony_ci 258e41f4b71Sopenharmony_ci**Error codes** 259e41f4b71Sopenharmony_ci 260e41f4b71Sopenharmony_ciFor details about the error codes, see [ohos.telephony (Telephony) Error Codes](errorcode-telephony.md). 261e41f4b71Sopenharmony_ci 262e41f4b71Sopenharmony_ci| ID| Error Message | 263e41f4b71Sopenharmony_ci| -------- | -------------------------------------------- | 264e41f4b71Sopenharmony_ci| 201 | Permission denied. | 265e41f4b71Sopenharmony_ci| 202 | Non-system applications use system APIs. | 266e41f4b71Sopenharmony_ci| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. | 267e41f4b71Sopenharmony_ci| 8300001 | Invalid parameter value. | 268e41f4b71Sopenharmony_ci| 8300003 | System internal error. | 269e41f4b71Sopenharmony_ci| 8300999 | Unknown error. | 270e41f4b71Sopenharmony_ci 271e41f4b71Sopenharmony_ci**Example** 272e41f4b71Sopenharmony_ci 273e41f4b71Sopenharmony_ci```ts 274e41f4b71Sopenharmony_ciimport { window } from '@kit.ArkUI'; 275e41f4b71Sopenharmony_ciimport { UIAbility } from '@kit.AbilityKit'; 276e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit'; 277e41f4b71Sopenharmony_ciimport { vcard } from '@kit.TelephonyKit'; 278e41f4b71Sopenharmony_ciimport { dataSharePredicates } from '@kit.ArkData'; 279e41f4b71Sopenharmony_ci 280e41f4b71Sopenharmony_ciclass EntryAbility extends UIAbility { 281e41f4b71Sopenharmony_ci onWindowStageCreate(windowStage: window.WindowStage) { 282e41f4b71Sopenharmony_ci let predicates = new dataSharePredicates.DataSharePredicates(); 283e41f4b71Sopenharmony_ci predicates.equalTo("NAME", "Rose"); 284e41f4b71Sopenharmony_ci let options: vcard.VCardBuilderOptions = { 285e41f4b71Sopenharmony_ci cardType: vcard.VCardType.VERSION_21, 286e41f4b71Sopenharmony_ci charset: "UTF-8" 287e41f4b71Sopenharmony_ci }; 288e41f4b71Sopenharmony_ci vcard.exportVCard(this.context, predicates, options, (err: BusinessError, data: string) => { 289e41f4b71Sopenharmony_ci console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); 290e41f4b71Sopenharmony_ci }); 291e41f4b71Sopenharmony_ci } 292e41f4b71Sopenharmony_ci} 293e41f4b71Sopenharmony_ci``` 294e41f4b71Sopenharmony_ci 295e41f4b71Sopenharmony_ci## vcard.exportVCard<sup>11+</sup> 296e41f4b71Sopenharmony_ci 297e41f4b71Sopenharmony_ciexportVCard\(context: Context, predicates: dataSharePredicates.DataSharePredicates, options?: VCardBuilderOptions\): Promise\<string\> 298e41f4b71Sopenharmony_ci 299e41f4b71Sopenharmony_ciExports contacts to a **.vcf** file. This API uses a promise to return the result. 300e41f4b71Sopenharmony_ci 301e41f4b71Sopenharmony_ci**Required permissions**: ohos.permission.WRITE_CONTACTS and ohos.permission.READ_CONTACTS 302e41f4b71Sopenharmony_ci 303e41f4b71Sopenharmony_ci**System API**: This is a system API. 304e41f4b71Sopenharmony_ci 305e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Telephony.CoreService 306e41f4b71Sopenharmony_ci 307e41f4b71Sopenharmony_ci**Parameters** 308e41f4b71Sopenharmony_ci 309e41f4b71Sopenharmony_ci| Name| Type | Mandatory| Description | 310e41f4b71Sopenharmony_ci| ------ | ------ | ---- | -------------------------------------- | 311e41f4b71Sopenharmony_ci| context | Context | Yes | Application context.| 312e41f4b71Sopenharmony_ci| predicates | dataSharePredicates.DataSharePredicates | Yes | Query statement.| 313e41f4b71Sopenharmony_ci| options | [VCardBuilderOptions](#vcardbuilderoptions11) | No | VCard version and encoding type.| 314e41f4b71Sopenharmony_ci 315e41f4b71Sopenharmony_ci**Return value** 316e41f4b71Sopenharmony_ci 317e41f4b71Sopenharmony_ci| Type | Description | 318e41f4b71Sopenharmony_ci| --------------- | ------------------------------- | 319e41f4b71Sopenharmony_ci| Promise\<string\> | Promise used to return the result, which is the address of the **.vcf** file.| 320e41f4b71Sopenharmony_ci 321e41f4b71Sopenharmony_ci**Error codes** 322e41f4b71Sopenharmony_ci 323e41f4b71Sopenharmony_ciFor details about the error codes, see [ohos.telephony (Telephony) Error Codes](errorcode-telephony.md). 324e41f4b71Sopenharmony_ci 325e41f4b71Sopenharmony_ci| ID| Error Message | 326e41f4b71Sopenharmony_ci| -------- | -------------------------------------------- | 327e41f4b71Sopenharmony_ci| 201 | Permission denied. | 328e41f4b71Sopenharmony_ci| 202 | Non-system applications use system APIs. | 329e41f4b71Sopenharmony_ci| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. | 330e41f4b71Sopenharmony_ci| 8300001 | Invalid parameter value. | 331e41f4b71Sopenharmony_ci| 8300003 | System internal error. | 332e41f4b71Sopenharmony_ci| 8300999 | Unknown error. | 333e41f4b71Sopenharmony_ci 334e41f4b71Sopenharmony_ci**Example** 335e41f4b71Sopenharmony_ci 336e41f4b71Sopenharmony_ci```ts 337e41f4b71Sopenharmony_ciimport { window } from '@kit.ArkUI'; 338e41f4b71Sopenharmony_ciimport { UIAbility } from '@kit.AbilityKit'; 339e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit'; 340e41f4b71Sopenharmony_ciimport { vcard } from '@kit.TelephonyKit'; 341e41f4b71Sopenharmony_ciimport { dataSharePredicates } from '@kit.ArkData'; 342e41f4b71Sopenharmony_ci 343e41f4b71Sopenharmony_ciclass EntryAbility extends UIAbility { 344e41f4b71Sopenharmony_ci onWindowStageCreate(windowStage: window.WindowStage) { 345e41f4b71Sopenharmony_ci let predicates = new dataSharePredicates.DataSharePredicates(); 346e41f4b71Sopenharmony_ci predicates.equalTo("NAME", "Rose"); 347e41f4b71Sopenharmony_ci let options: vcard.VCardBuilderOptions = { 348e41f4b71Sopenharmony_ci cardType: vcard.VCardType.VERSION_21, 349e41f4b71Sopenharmony_ci charset: "UTF-8" 350e41f4b71Sopenharmony_ci }; 351e41f4b71Sopenharmony_ci vcard.exportVCard(this.context, predicates, options).then(() => { 352e41f4b71Sopenharmony_ci console.log(`exportVCard success.`); 353e41f4b71Sopenharmony_ci }).catch((err: BusinessError) => { 354e41f4b71Sopenharmony_ci console.log(`exportVCard failed, promise: err->${JSON.stringify(err)}`); 355e41f4b71Sopenharmony_ci }); 356e41f4b71Sopenharmony_ci } 357e41f4b71Sopenharmony_ci} 358e41f4b71Sopenharmony_ci 359e41f4b71Sopenharmony_ci``` 360e41f4b71Sopenharmony_ci 361e41f4b71Sopenharmony_ci## VCardBuilderOptions<sup>11+</sup> 362e41f4b71Sopenharmony_ci 363e41f4b71Sopenharmony_ciDefines the VCard information. 364e41f4b71Sopenharmony_ci 365e41f4b71Sopenharmony_ci**System API**: This is a system API. 366e41f4b71Sopenharmony_ci 367e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Telephony.CoreService 368e41f4b71Sopenharmony_ci 369e41f4b71Sopenharmony_ci| Name | Type | Mandatory| Description | 370e41f4b71Sopenharmony_ci| ------------ | ------ | ---- | ---------- | 371e41f4b71Sopenharmony_ci| cardType | [VCardType](#vcardtype11) | No | VCard version. The default value is **VERSION_21**. | 372e41f4b71Sopenharmony_ci| charset | string | No | VCard encoding type. The default value is **UTF-8**. | 373e41f4b71Sopenharmony_ci 374e41f4b71Sopenharmony_ci## VCardType<sup>11+</sup> 375e41f4b71Sopenharmony_ci 376e41f4b71Sopenharmony_ciEnumerates VCard versions. 377e41f4b71Sopenharmony_ci 378e41f4b71Sopenharmony_ci**System API**: This is a system API. 379e41f4b71Sopenharmony_ci 380e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Telephony.CoreService 381e41f4b71Sopenharmony_ci 382e41f4b71Sopenharmony_ci| Name | Value | Description | 383e41f4b71Sopenharmony_ci| --------------- | ---- | ---------- | 384e41f4b71Sopenharmony_ci| VERSION_21 | 0 | VCard 2.1.| 385e41f4b71Sopenharmony_ci| VERSION_30 | 1 | VCard 3.0.| 386e41f4b71Sopenharmony_ci| VERSION_40 | 2 | VCard 4.0.| 387