1# udmf.h 2 3## Overview 4 5Defines the APIs, data structs, and enums for accessing the UDMF. 6 7**File to include**: <database/udmf/udmf.h> 8 9**Library**: libudmf.so 10 11**System capability**: SystemCapability.DistributedDataManager.UDMF.Core 12 13**Since**: 12 14 15**Related module**: [UDMF](capi-udmf.md) 16 17## Summary 18 19### Structs 20 21| Name| typedef Keyword| Description| 22| -- | -- | -- | 23| [OH_UdmfData](capi-udmf-oh-udmfdata.md) | OH_UdmfData | Defines a struct for a unified data object.| 24| [OH_UdmfRecord](capi-udmf-oh-udmfrecord.md) | OH_UdmfRecord | Defines a struct for a data record in a unified data object.| 25| [OH_UdmfRecordProvider](capi-udmf-oh-udmfrecordprovider.md) | OH_UdmfRecordProvider | Defines a struct for the data record provider in a unified data object.| 26| [OH_UdmfProperty](capi-udmf-oh-udmfproperty.md) | OH_UdmfProperty | Defines a struct for a data record property in a uniform data object.| 27| [OH_Udmf_ProgressInfo](capi-udmf-oh-udmf-progressinfo.md) | OH_Udmf_ProgressInfo | Defines a struct for progress information.| 28| [OH_UdmfGetDataParams](capi-udmf-oh-udmfgetdataparams.md) | OH_UdmfGetDataParams | Defines a struct for parameters used to obtain UDMF data asynchronously.| 29| [OH_UdmfOptions](capi-udmf-oh-udmfoptions.md) | OH_UdmfOptions | Defines the optional parameters for data operations.| 30| [OH_UdmfDataLoadParams](capi-udmf-oh-udmfdataloadparams.md) | OH_UdmfDataLoadParams | Defines a struct for data loading parameters.| 31| [OH_UdmfDataLoadInfo](capi-udmf-oh-udmfdataloadinfo.md) | OH_UdmfDataLoadInfo | Defines a struct for the data loading information.| 32 33### Enums 34 35| Name| typedef Keyword| Description| 36| -- | -- | -- | 37| [Udmf_Intention](#udmf_intention) | Udmf_Intention | Enumerates the UDMF data channel types.| 38| [Udmf_ShareOption](#udmf_shareoption) | Udmf_ShareOption | Enumerates the options for using the unified data in a device.| 39| [Udmf_FileConflictOptions](#udmf_fileconflictoptions) | Udmf_FileConflictOptions | Enumerates the options used to resolve file copy conflicts.| 40| [Udmf_ProgressIndicator](#udmf_progressindicator) | Udmf_ProgressIndicator | Enumerates the progress indicator options. You can use the default progress indicator as required.| 41| [Udmf_Visibility](#udmf_visibility) | Udmf_Visibility | Enumerates data visibility level.| 42 43### Functions 44 45| Name| typedef Keyword| Description| 46| -- | -- | -- | 47| [UDMF_KEY_BUFFER_LEN (512)](#udmf_key_buffer_len) | - | Defines minimum length of the buffer that holds the key (unique identifier) of a unified data object.| 48| [typedef void (\*OH_Udmf_DataProgressListener)(OH_Udmf_ProgressInfo* progressInfo, OH_UdmfData* data)](#oh_udmf_dataprogresslistener) | OH_Udmf_DataProgressListener | Defines the callback used to return the data retrieval progress information and data obtained.<br>A null pointer is returned if the progress is less than 100%. The data obtained is returned only when the progress reaches 100%.| 49| [OH_UdmfData* OH_UdmfData_Create()](#oh_udmfdata_create) | - | Creates an [OH_UdmfData](capi-udmf-oh-udmfdata.md) instance and a pointer to it. If this pointer is no longer required, use [OH_UdmfData_Destroy](capi-udmf-h.md#oh_udmfdata_destroy) to destroy it. Otherwise, memory leaks may occur.| 50| [void OH_UdmfData_Destroy(OH_UdmfData* pThis)](#oh_udmfdata_destroy) | - | Destroys an [OH_UdmfData](capi-udmf-oh-udmfdata.md) instance.| 51| [int OH_UdmfData_AddRecord(OH_UdmfData* pThis, OH_UdmfRecord* record)](#oh_udmfdata_addrecord) | - | Adds an [OH_UdmfRecord](capi-udmf-oh-udmfrecord.md) to an [OH_UdmfData](capi-udmf-oh-udmfdata.md) instance.| 52| [bool OH_UdmfData_HasType(OH_UdmfData* pThis, const char* type)](#oh_udmfdata_hastype) | - | Checks whether the specified type exists in an [OH_UdmfData](capi-udmf-oh-udmfdata.md) instance.| 53| [char** OH_UdmfData_GetTypes(OH_UdmfData* pThis, unsigned int* count)](#oh_udmfdata_gettypes) | - | Obtains all data types in an [OH_UdmfData](capi-udmf-oh-udmfdata.md) instance.| 54| [OH_UdmfRecord** OH_UdmfData_GetRecords(OH_UdmfData* pThis, unsigned int* count)](#oh_udmfdata_getrecords) | - | Obtains all records contained in an [OH_UdmfData](capi-udmf-oh-udmfdata.md) instance.| 55| [typedef void (\*UdmfData_Finalize)(void* context)](#udmfdata_finalize) | UdmfData_Finalize | Defines a callback function used to release the context. This callback is invoked when the **OH_UdmfRecordProvider** instance is destroyed.| 56| [OH_UdmfRecordProvider* OH_UdmfRecordProvider_Create()](#oh_udmfrecordprovider_create) | - | Creates an [OH_UdmfRecordProvider](capi-udmf-oh-udmfrecordprovider.md) instance and a pointer to it. If this pointer is no longer required, use [OH_UdmfRecordProvider_Destroy](capi-udmf-h.md#oh_udmfrecordprovider_destroy) to destroy it. Otherwise, memory leaks may occur.| 57| [int OH_UdmfRecordProvider_Destroy(OH_UdmfRecordProvider* provider)](#oh_udmfrecordprovider_destroy) | - | Destroys an [OH_UdmfRecordProvider](capi-udmf-oh-udmfrecordprovider.md) instance.| 58| [typedef void* (\*OH_UdmfRecordProvider_GetData)(void* context, const char* type)](#oh_udmfrecordprovider_getdata) | OH_UdmfRecordProvider_GetData | Defines a callback function used to obtain data by type. This callback will be invoked to return the data obtained from **OH_UdmfRecord**.| 59| [int OH_UdmfRecordProvider_SetData(OH_UdmfRecordProvider* provider, void* context, const OH_UdmfRecordProvider_GetData callback, const UdmfData_Finalize finalize)](#oh_udmfrecordprovider_setdata) | - | Sets a callback for an **OH_UdmfRecordProvider** instance to provide data.| 60| [OH_UdmfRecord* OH_UdmfRecord_Create()](#oh_udmfrecord_create) | - | Creates an [OH_UdmfRecord](capi-udmf-oh-udmfrecord.md) instance and a pointer to it. If this pointer is no longer required, use [OH_UdmfRecord_Destroy](capi-udmf-h.md#oh_udmfrecord_destroy) to destroy it. Otherwise, memory leaks may occur.| 61| [void OH_UdmfRecord_Destroy(OH_UdmfRecord* pThis)](#oh_udmfrecord_destroy) | - | Destroys an [OH_UdmfRecord](capi-udmf-oh-udmfrecord.md) instance.| 62| [int OH_UdmfRecord_AddGeneralEntry(OH_UdmfRecord* pThis, const char* typeId, unsigned char* entry, unsigned int count)](#oh_udmfrecord_addgeneralentry) | - | Adds customized general data to an [OH_UdmfRecord](capi-udmf-oh-udmfrecord.md) instance. This API cannot be used to add data of UDS types (such as PlainText, Link, and Pixelmap).| 63| [int OH_UdmfRecord_AddPlainText(OH_UdmfRecord* pThis, OH_UdsPlainText* plainText)](#oh_udmfrecord_addplaintext) | - | Adds data of the [OH_UdsPlainText](capi-udmf-oh-udsplaintext.md) type to an [OH_UdmfRecord](capi-udmf-oh-udmfrecord.md) instance.| 64| [int OH_UdmfRecord_AddHyperlink(OH_UdmfRecord* pThis, OH_UdsHyperlink* hyperlink)](#oh_udmfrecord_addhyperlink) | - | Adds data of the [OH_UdsHyperlink](capi-udmf-oh-udshyperlink.md) type to an [OH_UdmfRecord](capi-udmf-oh-udmfrecord.md) instance.| 65| [int OH_UdmfRecord_AddHtml(OH_UdmfRecord* pThis, OH_UdsHtml* html)](#oh_udmfrecord_addhtml) | - | Adds data of the [OH_UdsHtml](capi-udmf-oh-udshtml.md) type to an [OH_UdmfRecord](capi-udmf-oh-udmfrecord.md) instance.| 66| [int OH_UdmfRecord_AddAppItem(OH_UdmfRecord* pThis, OH_UdsAppItem* appItem)](#oh_udmfrecord_addappitem) | - | Adds data of the [OH_UdsAppItem](capi-udmf-oh-udsappitem.md) type to an [OH_UdmfRecord](capi-udmf-oh-udmfrecord.md) instance.| 67| [int OH_UdmfRecord_AddFileUri(OH_UdmfRecord* pThis, OH_UdsFileUri* fileUri)](#oh_udmfrecord_addfileuri) | - | Adds data of the [OH_UdsFileUri](capi-udmf-oh-udsfileuri.md) type to an [OH_UdmfRecord](capi-udmf-oh-udmfrecord.md) instance.| 68| [int OH_UdmfRecord_AddPixelMap(OH_UdmfRecord* pThis, OH_UdsPixelMap* pixelMap)](#oh_udmfrecord_addpixelmap) | - | Adds data of the [OH_UdsPixelMap](capi-udmf-oh-udspixelmap.md) type to an [OH_UdmfRecord](capi-udmf-oh-udmfrecord.md) instance.| 69| [int OH_UdmfRecord_AddArrayBuffer(OH_UdmfRecord* record, const char* type, OH_UdsArrayBuffer* buffer)](#oh_udmfrecord_addarraybuffer) | - | Adds data of the [OH_UdsArrayBuffer](capi-udmf-oh-udsarraybuffer.md) type to an [OH_UdmfRecord](capi-udmf-oh-udmfrecord.md) instance.| 70| [int OH_UdmfRecord_AddContentForm(OH_UdmfRecord* pThis, OH_UdsContentForm* contentForm)](#oh_udmfrecord_addcontentform) | - | Adds data of the [OH_UdsContentForm](capi-udmf-oh-udscontentform.md) type to an [OH_UdmfRecord](capi-udmf-oh-udmfrecord.md) instance.| 71| [char** OH_UdmfRecord_GetTypes(OH_UdmfRecord* pThis, unsigned int* count)](#oh_udmfrecord_gettypes) | - | Obtains all data types in an [OH_UdmfRecord](capi-udmf-oh-udmfrecord.md) instance.| 72| [int OH_UdmfRecord_GetGeneralEntry(OH_UdmfRecord* pThis, const char* typeId, unsigned char** entry, unsigned int* count)](#oh_udmfrecord_getgeneralentry) | - | Obtains the data of the specified type in an [OH_UdmfRecord](capi-udmf-oh-udmfrecord.md) instance.| 73| [int OH_UdmfRecord_GetPlainText(OH_UdmfRecord* pThis, OH_UdsPlainText* plainText)](#oh_udmfrecord_getplaintext) | - | Obtains [OH_UdsPlainText](capi-udmf-oh-udsplaintext.md) data from an [OH_UdmfRecord](capi-udmf-oh-udmfrecord.md) instance.| 74| [int OH_UdmfRecord_GetHyperlink(OH_UdmfRecord* pThis, OH_UdsHyperlink* hyperlink)](#oh_udmfrecord_gethyperlink) | - | Obtains [OH_UdsHyperlink](capi-udmf-oh-udshyperlink.md) data from an [OH_UdmfRecord](capi-udmf-oh-udmfrecord.md) instance.| 75| [int OH_UdmfRecord_GetHtml(OH_UdmfRecord* pThis, OH_UdsHtml* html)](#oh_udmfrecord_gethtml) | - | Obtains [OH_UdsHtml](capi-udmf-oh-udshtml.md) data from an [OH_UdmfRecord](capi-udmf-oh-udmfrecord.md) instance.| 76| [int OH_UdmfRecord_GetAppItem(OH_UdmfRecord* pThis, OH_UdsAppItem* appItem)](#oh_udmfrecord_getappitem) | - | Obtains [OH_UdsAppItem](capi-udmf-oh-udsappitem.md) data from an [OH_UdmfRecord](capi-udmf-oh-udmfrecord.md) instance.| 77| [int OH_UdmfRecord_SetProvider(OH_UdmfRecord* pThis, const char* const* types, unsigned int count, OH_UdmfRecordProvider* provider)](#oh_udmfrecord_setprovider) | - | Sets the [OH_UdmfRecordProvider](capi-udmf-oh-udmfrecordprovider.md) in an [OH_UdmfRecord](capi-udmf-oh-udmfrecord.md) instance.| 78| [int OH_UdmfRecord_GetFileUri(OH_UdmfRecord* pThis, OH_UdsFileUri* fileUri)](#oh_udmfrecord_getfileuri) | - | Obtains [OH_UdsFileUri](capi-udmf-oh-udsfileuri.md) data from an [OH_UdmfRecord](capi-udmf-oh-udmfrecord.md) instance.| 79| [int OH_UdmfRecord_GetPixelMap(OH_UdmfRecord* pThis, OH_UdsPixelMap* pixelMap)](#oh_udmfrecord_getpixelmap) | - | Obtains [OH_UdsPixelMap](capi-udmf-oh-udspixelmap.md) data from an [OH_UdmfRecord](capi-udmf-oh-udmfrecord.md) instance.| 80| [int OH_UdmfRecord_GetArrayBuffer(OH_UdmfRecord* record, const char* type, OH_UdsArrayBuffer* buffer)](#oh_udmfrecord_getarraybuffer) | - | Obtains [OH_UdsArrayBuffer](capi-udmf-oh-udsarraybuffer.md) data from an [OH_UdmfRecord](capi-udmf-oh-udmfrecord.md) instance.| 81| [int OH_UdmfRecord_GetContentForm(OH_UdmfRecord* pThis, OH_UdsContentForm* contentForm)](#oh_udmfrecord_getcontentform) | - | Obtains [OH_UdsContentForm](capi-udmf-oh-udscontentform.md) data from an [OH_UdmfRecord](capi-udmf-oh-udmfrecord.md) instance.| 82| [int OH_UdmfData_GetPrimaryPlainText(OH_UdmfData* data, OH_UdsPlainText* plainText)](#oh_udmfdata_getprimaryplaintext) | - | Obtains the first [OH_UdsPlainText](capi-udmf-oh-udsplaintext.md) data from an [OH_UdmfData](capi-udmf-oh-udmfdata.md) instance.| 83| [int OH_UdmfData_GetPrimaryHtml(OH_UdmfData* data, OH_UdsHtml* html)](#oh_udmfdata_getprimaryhtml) | - | Obtains the first [OH_UdsHtml](capi-udmf-oh-udshtml.md) data from an [OH_UdmfData](capi-udmf-oh-udmfdata.md) instance.| 84| [int OH_UdmfData_GetRecordCount(OH_UdmfData* data)](#oh_udmfdata_getrecordcount) | - | Obtains the number of data records contained in an [OH_UdmfData](capi-udmf-oh-udmfdata.md) instance.| 85| [OH_UdmfRecord* OH_UdmfData_GetRecord(OH_UdmfData* data, unsigned int index)](#oh_udmfdata_getrecord) | - | Obtains the specified data record from an [OH_UdmfData](capi-udmf-oh-udmfdata.md) instance.| 86| [bool OH_UdmfData_IsLocal(OH_UdmfData* data)](#oh_udmfdata_islocal) | - | Checks whether an [OH_UdmfData](capi-udmf-oh-udmfdata.md) instance is from the local device.| 87| [OH_UdmfProperty* OH_UdmfProperty_Create(OH_UdmfData* unifiedData)](#oh_udmfproperty_create) | - | Creates an [OH_UdmfProperty](capi-udmf-oh-udmfproperty.md) instance and a pointer to it. If this pointer is no longer required, use [OH_UdmfProperty_Destroy](capi-udmf-h.md#oh_udmfproperty_destroy) to destroy it. Otherwise, memory leaks may occur.| 88| [void OH_UdmfProperty_Destroy(OH_UdmfProperty* pThis)](#oh_udmfproperty_destroy) | - | Destroys an [OH_UdmfProperty](capi-udmf-oh-udmfproperty.md) instance.| 89| [const char* OH_UdmfProperty_GetTag(OH_UdmfProperty* pThis)](#oh_udmfproperty_gettag) | - | Obtains the custom tag value from an [OH_UdmfProperty](capi-udmf-oh-udmfproperty.md) instance.| 90| [int64_t OH_UdmfProperty_GetTimestamp(OH_UdmfProperty* pThis)](#oh_udmfproperty_gettimestamp) | - | Obtains the timestamp from an [OH_UdmfProperty](capi-udmf-oh-udmfproperty.md) instance.| 91| [Udmf_ShareOption OH_UdmfProperty_GetShareOption(OH_UdmfProperty* pThis)](#oh_udmfproperty_getshareoption) | - | Obtains the share option from an [OH_UdmfProperty](capi-udmf-oh-udmfproperty.md) instance.| 92| [int OH_UdmfProperty_GetExtrasIntParam(OH_UdmfProperty* pThis, const char* key, int defaultValue)](#oh_udmfproperty_getextrasintparam) | - | Obtains the customized extra integer parameter from an [OH_UdmfProperty](capi-udmf-oh-udmfproperty.md) instance.| 93| [const char* OH_UdmfProperty_GetExtrasStringParam(OH_UdmfProperty* pThis, const char* key)](#oh_udmfproperty_getextrasstringparam) | - | Obtains the customized extra string parameter from an [OH_UdmfProperty](capi-udmf-oh-udmfproperty.md) instance.| 94| [int OH_UdmfProperty_SetTag(OH_UdmfProperty* pThis, const char* tag)](#oh_udmfproperty_settag) | - | Sets the tag value for an [OH_UdmfProperty](capi-udmf-oh-udmfproperty.md) instance.| 95| [int OH_UdmfProperty_SetShareOption(OH_UdmfProperty* pThis, Udmf_ShareOption option)](#oh_udmfproperty_setshareoption) | - | Sets the [Udmf_ShareOption](capi-udmf-h.md#udmf_shareoption) for an [OH_UdmfProperty](capi-udmf-oh-udmfproperty.md) instance.| 96| [int OH_UdmfProperty_SetExtrasIntParam(OH_UdmfProperty* pThis, const char* key, int param)](#oh_udmfproperty_setextrasintparam) | - | Sets the extra integer parameter for an [OH_UdmfProperty](capi-udmf-oh-udmfproperty.md) instance.| 97| [int OH_UdmfProperty_SetExtrasStringParam(OH_UdmfProperty* pThis, const char* key, const char* param)](#oh_udmfproperty_setextrasstringparam) | - | Sets the extra string parameter for an [OH_UdmfProperty](capi-udmf-oh-udmfproperty.md) instance.| 98| [OH_UdmfOptions* OH_UdmfOptions_Create()](#oh_udmfoptions_create) | - | Creates an [OH_UdmfOptions](capi-udmf-oh-udmfoptions.md) instance.| 99| [void OH_UdmfOptions_Destroy(OH_UdmfOptions* pThis)](#oh_udmfoptions_destroy) | - | Destroys an [OH_UdmfOptions](capi-udmf-oh-udmfoptions.md) instance.| 100| [const char* OH_UdmfOptions_GetKey(OH_UdmfOptions* pThis)](#oh_udmfoptions_getkey) | - | Obtains the key (unique identifier) from an [OH_UdmfOptions](capi-udmf-oh-udmfoptions.md) instance.| 101| [int OH_UdmfOptions_SetKey(OH_UdmfOptions* pThis, const char* key)](#oh_udmfoptions_setkey) | - | Sets the key (unique identifier) in an [OH_UdmfOptions](capi-udmf-oh-udmfoptions.md) instance.| 102| [Udmf_Intention OH_UdmfOptions_GetIntention(OH_UdmfOptions* pThis)](#oh_udmfoptions_getintention) | - | Obtains the data channel information from an [OH_UdmfOptions](capi-udmf-oh-udmfoptions.md) instance.| 103| [int OH_UdmfOptions_SetIntention(OH_UdmfOptions* pThis, Udmf_Intention intention)](#oh_udmfoptions_setintention) | - | Sets the data channel content parameter in an [OH_UdmfOptions](capi-udmf-oh-udmfoptions.md) instance.| 104| [int OH_UdmfOptions_Reset(OH_UdmfOptions* pThis)](#oh_udmfoptions_reset) | - | Resets an [OH_UdmfOptions](capi-udmf-oh-udmfoptions.md) instance to empty.| 105| [int OH_Udmf_GetUnifiedData(const char* key, Udmf_Intention intention, OH_UdmfData* unifiedData)](#oh_udmf_getunifieddata) | - | Obtains an [OH_UdmfData](capi-udmf-oh-udmfdata.md) instance from the UDMF database.| 106| [int OH_Udmf_GetUnifiedDataByOptions(OH_UdmfOptions* options, OH_UdmfData** dataArray, unsigned int* dataSize)](#oh_udmf_getunifieddatabyoptions) | - | Obtains an [OH_UdmfData](capi-udmf-oh-udmfdata.md) instance from the UDMF database by data channel type.| 107| [int OH_Udmf_SetUnifiedData(Udmf_Intention intention, OH_UdmfData* unifiedData, char* key, unsigned int keyLen)](#oh_udmf_setunifieddata) | - | Sets an [OH_UdmfData](capi-udmf-oh-udmfdata.md) instance in the UDMF database.| 108| [int OH_Udmf_SetUnifiedDataByOptions(OH_UdmfOptions* options, OH_UdmfData *unifiedData, char *key, unsigned int keyLen)](#oh_udmf_setunifieddatabyoptions) | - | Sets an [OH_UdmfData](capi-udmf-oh-udmfdata.md) instance in the UDMF database.| 109| [int OH_Udmf_UpdateUnifiedData(OH_UdmfOptions* options, OH_UdmfData* unifiedData)](#oh_udmf_updateunifieddata) | - | Updates an [OH_UdmfData](capi-udmf-oh-udmfdata.md) instance in the UDMF database.| 110| [int OH_Udmf_DeleteUnifiedData(OH_UdmfOptions* options, OH_UdmfData** dataArray, unsigned int* dataSize)](#oh_udmf_deleteunifieddata) | - | Deletes an [OH_UdmfData](capi-udmf-oh-udmfdata.md) instance from the UDMF database.| 111| [void OH_Udmf_DestroyDataArray(OH_UdmfData** dataArray, unsigned int dataSize)](#oh_udmf_destroydataarray) | - | Destroys the memory of the data array.| 112| [int OH_UdmfProgressInfo_GetProgress(OH_Udmf_ProgressInfo* progressInfo)](#oh_udmfprogressinfo_getprogress) | - | Obtains the progress (in percentage) from an [OH_Udmf_ProgressInfo](capi-udmf-oh-udmf-progressinfo.md) instance.| 113| [int OH_UdmfProgressInfo_GetStatus(OH_Udmf_ProgressInfo* progressInfo)](#oh_udmfprogressinfo_getstatus) | - | Obtains the status information from an [OH_Udmf_ProgressInfo](capi-udmf-oh-udmf-progressinfo.md) instance.| 114| [OH_UdmfGetDataParams* OH_UdmfGetDataParams_Create()](#oh_udmfgetdataparams_create) | - | Creates an [OH_UdmfGetDataParams](capi-udmf-oh-udmfgetdataparams.md) instance and a pointer to it.<br>If this pointer is no longer required, use [OH_UdmfGetDataParams_Destroy](capi-udmf-h.md#oh_udmfgetdataparams_destroy) to destroy it. Otherwise, memory leaks may occur.| 115| [void OH_UdmfGetDataParams_Destroy(OH_UdmfGetDataParams* pThis)](#oh_udmfgetdataparams_destroy) | - | Destroys an [OH_UdmfGetDataParams](capi-udmf-oh-udmfgetdataparams.md) instance.| 116| [void OH_UdmfGetDataParams_SetDestUri(OH_UdmfGetDataParams* params, const char* destUri)](#oh_udmfgetdataparams_setdesturi) | - | Sets the destination directory in an [OH_UdmfGetDataParams](capi-udmf-oh-udmfgetdataparams.md) instance.<br>If the destination directory is set, data of the file type will be copied to the specified directory. The file type data obtained in the callback will be replaced with the URI of the destination directory.<br>If the destination directory is not specified, the file will not be copied. The file type data obtained in the callback is the URI of the source directory.<br>If the application involves complex file processing or files need to be copied to multiple directories, you are advised to leave this parameter unspecified and let the application handle the file copy.| 117| [void OH_UdmfGetDataParams_SetFileConflictOptions(OH_UdmfGetDataParams* params, const Udmf_FileConflictOptions options)](#oh_udmfgetdataparams_setfileconflictoptions) | - | Sets the policy for resolving file conflicts in an [OH_UdmfGetDataParams](capi-udmf-oh-udmfgetdataparams.md) instance.| 118| [void OH_UdmfGetDataParams_SetProgressIndicator(OH_UdmfGetDataParams* params, const Udmf_ProgressIndicator progressIndicator)](#oh_udmfgetdataparams_setprogressindicator) | - | Sets the progress indicator in an [OH_UdmfGetDataParams](capi-udmf-oh-udmfgetdataparams.md) instance.| 119| [void OH_UdmfGetDataParams_SetDataProgressListener(OH_UdmfGetDataParams* params, const OH_Udmf_DataProgressListener dataProgressListener)](#oh_udmfgetdataparams_setdataprogresslistener) | - | Sets the callback used to return the progress obtained in an [OH_UdmfGetDataParams](capi-udmf-oh-udmfgetdataparams.md) instance.| 120| [Udmf_Visibility OH_UdmfOptions_GetVisibility(OH_UdmfOptions* pThis)](#oh_udmfoptions_getvisibility) | - | Obtains the data visibility level from an [OH_UdmfOptions](capi-udmf-oh-udmfoptions.md) instance.| 121| [int OH_UdmfOptions_SetVisibility(OH_UdmfOptions* pThis, Udmf_Visibility visibility)](#oh_udmfoptions_setvisibility) | - | Sets the data visibility level in an [OH_UdmfOptions](capi-udmf-oh-udmfoptions.md) instance.| 122| [typedef OH_UdmfData* (\*OH_Udmf_DataLoadHandler)(OH_UdmfDataLoadInfo* acceptableInfo)](#oh_udmf_dataloadhandler) | OH_Udmf_DataLoadHandler | Defines the callback used to load data.| 123| [OH_UdmfDataLoadParams* OH_UdmfDataLoadParams_Create()](#oh_udmfdataloadparams_create) | - | Creates an [OH_UdmfDataLoadParams](capi-udmf-oh-udmfdataloadparams.md) instance and a pointer to it.| 124| [void OH_UdmfDataLoadParams_Destroy(OH_UdmfDataLoadParams* pThis)](#oh_udmfdataloadparams_destroy) | - | Destroys an [OH_UdmfDataLoadParams](capi-udmf-oh-udmfdataloadparams.md) instance.| 125| [void OH_UdmfDataLoadParams_SetLoadHandler(OH_UdmfDataLoadParams* params, const OH_Udmf_DataLoadHandler dataLoadHandler)](#oh_udmfdataloadparams_setloadhandler) | - | Sets the processing function for data loading in an [OH_UdmfDataLoadParams](capi-udmf-oh-udmfdataloadparams.md) instance.| 126| [void OH_UdmfDataLoadParams_SetDataLoadInfo(OH_UdmfDataLoadParams* params, OH_UdmfDataLoadInfo* dataLoadInfo)](#oh_udmfdataloadparams_setdataloadinfo) | - | Sets data loading information in an [OH_UdmfDataLoadParams](capi-udmf-oh-udmfdataloadparams.md) instance.| 127| [OH_UdmfDataLoadInfo* OH_UdmfDataLoadInfo_Create()](#oh_udmfdataloadinfo_create) | - | Creates an [OH_UdmfDataLoadInfo](capi-udmf-oh-udmfdataloadinfo.md) instance.| 128| [void OH_UdmfDataLoadInfo_Destroy(OH_UdmfDataLoadInfo* dataLoadInfo)](#oh_udmfdataloadinfo_destroy) | - | Destroys an [OH_UdmfDataLoadInfo](capi-udmf-oh-udmfdataloadinfo.md) instance.| 129| [char** OH_UdmfDataLoadInfo_GetTypes(OH_UdmfDataLoadInfo* dataLoadInfo, unsigned int* count)](#oh_udmfdataloadinfo_gettypes) | - | Obtains the data types from an [OH_UdmfDataLoadInfo](capi-udmf-oh-udmfdataloadinfo.md) instance.| 130| [void OH_UdmfDataLoadInfo_SetType(OH_UdmfDataLoadInfo* dataLoadInfo, const char* type)](#oh_udmfdataloadinfo_settype) | - | Sets the data type in an [OH_UdmfDataLoadInfo](capi-udmf-oh-udmfdataloadinfo.md) instance.| 131| [int OH_UdmfDataLoadInfo_GetRecordCount(OH_UdmfDataLoadInfo* dataLoadInfo)](#oh_udmfdataloadinfo_getrecordcount) | - | Obtains the number of records in an [OH_UdmfDataLoadInfo](capi-udmf-oh-udmfdataloadinfo.md) instance.| 132| [void OH_UdmfDataLoadInfo_SetRecordCount(OH_UdmfDataLoadInfo* dataLoadInfo, unsigned int recordCount)](#oh_udmfdataloadinfo_setrecordcount) | - | Sets the number of records in an [OH_UdmfDataLoadInfo](capi-udmf-oh-udmfdataloadinfo.md) instance.| 133 134## Enum Description 135 136### Udmf_Intention 137 138``` 139enum Udmf_Intention 140``` 141 142**Description** 143 144Enumerates the UDMF data channel types. 145 146**Since**: 12 147 148| Name| Description| 149| -- | -- | 150| UDMF_INTENTION_DRAG | Channel for dragging data.| 151| UDMF_INTENTION_PASTEBOARD | Channel for pasteboard data.| 152| UDMF_INTENTION_DATA_HUB | Public data channel.<br>**Since**: 20| 153| UDMF_INTENTION_SYSTEM_SHARE | Channel for sharing data by the system.<br>**Since**: 20| 154| UDMF_INTENTION_PICKER | Channel for picker data.<br>**Since**: 20| 155| UDMF_INTENTION_MENU | Channel for menu data.<br>**Since**: 20| 156 157### Udmf_ShareOption 158 159``` 160enum Udmf_ShareOption 161``` 162 163**Description** 164 165Enumerates the options for using the unified data in a device. 166 167**Since**: 12 168 169| Name| Description| 170| -- | -- | 171| SHARE_OPTIONS_INVALID | Invalid use.| 172| SHARE_OPTIONS_IN_APP | **UnifiedData** can be used only in the same application of a device.| 173| SHARE_OPTIONS_CROSS_APP | **UnifiedData** can be used across applications of a device.| 174 175### Udmf_FileConflictOptions 176 177``` 178enum Udmf_FileConflictOptions 179``` 180 181**Description** 182 183Enumerates the options used to resolve file copy conflicts. 184 185**Since**: 15 186 187| Name| Description| 188| -- | -- | 189| UDMF_OVERWRITE = 0 | Overwrites the file with the same name in the destination directory. This is the default value.| 190| UDMF_SKIP = 1 | Skips the file if there is a file with the same name in the destination directory.| 191 192### Udmf_ProgressIndicator 193 194``` 195enum Udmf_ProgressIndicator 196``` 197 198**Description** 199 200Enumerates the progress indicator options. You can use the default progress indicator as required. 201 202**Since**: 15 203 204| Name| Description| 205| -- | -- | 206| UDMF_NONE = 0 | The default progress indicator is not used.| 207| UDMF_DEFAULT = 1 | The default progress indicator is used. If data is obtained within 500 ms, the default progress bar is not started.| 208 209### Udmf_Visibility 210 211``` 212enum Udmf_Visibility 213``` 214 215**Description** 216 217Enumerates data visibility level. 218 219**Since**: 20 220 221| Name| Description| 222| -- | -- | 223| UDMF_ALL | Visible to all applications.| 224| UDMF_OWN_PROCESS | Visible only to the data provider.| 225 226## Function Description 227 228### OH_UdmfGetDataParams_SetAcceptableInfo() 229 230``` 231void OH_UdmfGetDataParams_SetAcceptableInfo(OH_UdmfGetDataParams* params, OH_UdmfDataLoadInfo* acceptableInfo) 232``` 233 234**Description** 235 236Sets the acceptable data description in an [OH_UdmfGetDataParams](capi-udmf-oh-udmfgetdataparams.md) instance. 237 238**Since**: 20 239 240 241**Parameters** 242 243| Name| Description| 244| -- | -- | 245| [OH_UdmfGetDataParams](capi-udmf-oh-udmfgetdataparams.md)* params | Pointer to the [OH_UdmfGetDataParams](capi-udmf-oh-udmfgetdataparams.md) instance.| 246| [OH_UdmfDataLoadInfo](capi-udmf-oh-udmfdataloadinfo.md)* acceptableInfo | Pointer to the [OH_UdmfDataLoadInfo](capi-udmf-oh-udmfdataloadinfo.md) instance.| 247 248### OH_UdmfDataLoadParams_Create() 249 250``` 251OH_UdmfDataLoadParams* OH_UdmfDataLoadParams_Create() 252``` 253 254**Description** 255 256Creates an [OH_UdmfDataLoadParams](capi-udmf-oh-udmfdataloadparams.md) instance and a pointer to it. 257 258**Since**: 20 259 260**Returns** 261 262| Type| Description| 263| -- | -- | 264| [OH_UdmfDataLoadParams](capi-udmf-oh-udmfdataloadparams.md)* | Returns a pointer to the [OH_UdmfDataLoadParams](capi-udmf-oh-udmfdataloadparams.md) instance created if the operation is successful; returns **nullptr** otherwise.| 265 266### OH_UdmfDataLoadParams_Destroy() 267 268``` 269void OH_UdmfDataLoadParams_Destroy(OH_UdmfDataLoadParams* pThis) 270``` 271 272**Description** 273 274Destroys an [OH_UdmfDataLoadParams](capi-udmf-oh-udmfdataloadparams.md) instance. 275 276**Since**: 20 277 278**Parameters** 279 280| Name| Description| 281| -- | -- | 282| [OH_UdmfDataLoadParams](capi-udmf-oh-udmfdataloadparams.md)* pThis | Creates an [OH_UdmfDataLoadParams](capi-udmf-oh-udmfdataloadparams.md) instance and a pointer to it.| 283 284### OH_UdmfDataLoadParams_SetLoadHandler() 285 286``` 287void OH_UdmfDataLoadParams_SetLoadHandler(OH_UdmfDataLoadParams* params, const OH_Udmf_DataLoadHandler dataLoadHandler) 288``` 289 290**Description** 291 292Sets the processing function for data loading in an [OH_UdmfDataLoadParams](capi-udmf-oh-udmfdataloadparams.md) instance. 293 294**Since**: 20 295 296**Parameters** 297 298| Name| Description| 299| -- | -- | 300| [OH_UdmfDataLoadParams](capi-udmf-oh-udmfdataloadparams.md)* params | Creates an [OH_UdmfDataLoadParams](capi-udmf-oh-udmfdataloadparams.md) instance and a pointer to it.| 301| [const OH_Udmf_DataLoadHandler](capi-udmf-h.md#oh_udmf_dataloadhandler) dataLoadHandler | User-defined processing function for data loading.| 302 303### OH_UdmfDataLoadParams_SetDataLoadInfo() 304 305``` 306void OH_UdmfDataLoadParams_SetDataLoadInfo(OH_UdmfDataLoadParams* params, OH_UdmfDataLoadInfo* dataLoadInfo) 307``` 308 309**Description** 310 311Sets data loading information in an [OH_UdmfDataLoadParams](capi-udmf-oh-udmfdataloadparams.md) instance. 312 313**Since**: 20 314 315**Parameters** 316 317| Name| Description| 318| -- | -- | 319| [OH_UdmfDataLoadParams](capi-udmf-oh-udmfdataloadparams.md)* params | Pointer to the [OH_UdmfDataLoadParams](capi-udmf-oh-udmfdataloadparams.md) instance.| 320| [OH_UdmfDataLoadInfo](capi-udmf-oh-udmfdataloadinfo.md)* dataLoadInfo | Pointer to the [OH_UdmfDataLoadInfo](capi-udmf-oh-udmfdataloadinfo.md) instance.| 321 322### OH_UdmfDataLoadInfo_Create() 323 324``` 325OH_UdmfDataLoadInfo* OH_UdmfDataLoadInfo_Create() 326``` 327 328**Description** 329 330Creates an [OH_UdmfDataLoadInfo](capi-udmf-oh-udmfdataloadinfo.md) instance. 331 332**Since**: 20 333 334**Returns** 335 336| Type| Description| 337| -- | -- | 338| [OH_UdmfDataLoadInfo](capi-udmf-oh-udmfdataloadinfo.md)* | Returns a pointer to the [OH_UdmfDataLoadInfo](capi-udmf-oh-udmfdataloadinfo.md) instance created if the operation is successful; returns **nullptr** otherwise.| 339 340### OH_UdmfDataLoadInfo_Destroy() 341 342``` 343void OH_UdmfDataLoadInfo_Destroy(OH_UdmfDataLoadInfo* dataLoadInfo) 344``` 345 346**Description** 347 348Destroys an [OH_UdmfDataLoadInfo](capi-udmf-oh-udmfdataloadinfo.md) instance. 349 350**Since**: 20 351 352**Parameters** 353 354| Name| Description| 355| -- | -- | 356| [OH_UdmfDataLoadInfo](capi-udmf-oh-udmfdataloadinfo.md)* dataLoadInfo | Pointer to the [OH_UdmfDataLoadInfo](capi-udmf-oh-udmfdataloadinfo.md) instance.| 357 358### OH_UdmfDataLoadInfo_GetTypes() 359 360``` 361char** OH_UdmfDataLoadInfo_GetTypes(OH_UdmfDataLoadInfo* dataLoadInfo, unsigned int* count) 362``` 363 364**Description** 365 366Obtains the data types from an [OH_UdmfDataLoadInfo](capi-udmf-oh-udmfdataloadinfo.md) instance. 367 368**Since**: 20 369 370**Parameters** 371 372| Name| Description| 373| -- | -- | 374| [OH_UdmfDataLoadInfo](capi-udmf-oh-udmfdataloadinfo.md)* dataLoadInfo | Pointer to the [OH_UdmfDataLoadInfo](capi-udmf-oh-udmfdataloadinfo.md) instance.| 375| unsigned int* count | Number of data types returned.| 376 377**Returns** 378 379| Type| Description| 380| -- | -- | 381| char** | String array of the returned data types.| 382 383### OH_UdmfDataLoadInfo_SetType() 384 385``` 386void OH_UdmfDataLoadInfo_SetType(OH_UdmfDataLoadInfo* dataLoadInfo, const char* type) 387``` 388 389**Description** 390 391Sets the data type in an [OH_UdmfDataLoadInfo](capi-udmf-oh-udmfdataloadinfo.md) instance. 392 393**Since**: 20 394 395**Parameters** 396 397| Name| Description| 398| -- | -- | 399| [OH_UdmfDataLoadInfo](capi-udmf-oh-udmfdataloadinfo.md)* dataLoadInfo | Creates an [OH_UdmfDataLoadInfo](capi-udmf-oh-udmfdataloadinfo.md) instance.| 400| const char* type | A sting indicating the data type.| 401 402### OH_UdmfDataLoadInfo_GetRecordCount() 403 404``` 405int OH_UdmfDataLoadInfo_GetRecordCount(OH_UdmfDataLoadInfo* dataLoadInfo) 406``` 407 408**Description** 409 410Obtains the number of records in an [OH_UdmfDataLoadInfo](capi-udmf-oh-udmfdataloadinfo.md) instance. 411 412**Since**: 20 413 414**Parameters** 415 416| Name| Description| 417| -- | -- | 418| [OH_UdmfDataLoadInfo](capi-udmf-oh-udmfdataloadinfo.md)* dataLoadInfo | Creates an [OH_UdmfDataLoadInfo](capi-udmf-oh-udmfdataloadinfo.md) instance.| 419 420**Returns** 421 422| Type| Description| 423| -- | -- | 424| int | Number of records.| 425 426### OH_UdmfDataLoadInfo_SetRecordCount() 427 428``` 429void OH_UdmfDataLoadInfo_SetRecordCount(OH_UdmfDataLoadInfo* dataLoadInfo, unsigned int recordCount) 430``` 431 432**Description** 433 434Sets the number of records in an [OH_UdmfDataLoadInfo](capi-udmf-oh-udmfdataloadinfo.md) instance. 435 436**Since**: 20 437 438**Parameters** 439 440| Name| Description| 441| -- | -- | 442| [OH_UdmfDataLoadInfo](capi-udmf-oh-udmfdataloadinfo.md)* dataLoadInfo | Creates an [OH_UdmfDataLoadInfo](capi-udmf-oh-udmfdataloadinfo.md) instance.| 443| unsigned int recordCount | Number of records.| 444 445### OH_Udmf_DataLoadHandler() 446 447``` 448typedef OH_UdmfData* (*OH_Udmf_DataLoadHandler)(OH_UdmfDataLoadInfo* acceptableInfo) 449``` 450 451**Description** 452 453Defines the callback used to load data. 454 455**Since**: 20 456 457**Parameters** 458 459| Name| Description| 460| -- | -- | 461| [OH_UdmfDataLoadInfo](capi-udmf-oh-udmfdataloadinfo.md)* acceptableInfo | Data type and data size that can be received.| 462 463**Returns** 464 465| Type| Description| 466| -- | -- | 467| [OH_UdmfData](capi-udmf-oh-udmfdata.md)* (*OH_Udmf_DataLoadHandler) | Data to be loaded.| 468 469### OH_UdmfOptions_GetVisibility() 470 471``` 472Udmf_Visibility OH_UdmfOptions_GetVisibility(OH_UdmfOptions* pThis) 473``` 474 475**Description** 476 477Obtains the data visibility level from an [OH_UdmfOptions](capi-udmf-oh-udmfoptions.md) instance. 478 479**Since**: 20 480 481**Parameters** 482 483| Name| Description| 484| -- | -- | 485| [OH_UdmfOptions](capi-udmf-oh-udmfoptions.md)* pThis | Pointer to the [OH_UdmfOptions](capi-udmf-oh-udmfoptions.md) instance.| 486 487**Returns** 488 489| Type| Description| 490| -- | -- | 491| [Udmf_Visibility](capi-udmf-h.md#udmf_visibility) | Value of the [Udmf_Visibility](capi-udmf-h.md#udmf_visibility) instance obtained.| 492 493### OH_UdmfOptions_SetVisibility() 494 495``` 496int OH_UdmfOptions_SetVisibility(OH_UdmfOptions* pThis, Udmf_Visibility visibility) 497``` 498 499**Description** 500 501Sets the data visibility level in an [OH_UdmfOptions](capi-udmf-oh-udmfoptions.md) instance. 502 503**Since**: 20 504 505**Parameters** 506 507| Name| Description| 508| -- | -- | 509| [OH_UdmfOptions](capi-udmf-oh-udmfoptions.md)* pThis | Pointer to the [OH_UdmfOptions](capi-udmf-oh-udmfoptions.md) instance.| 510| [Udmf_Visibility](capi-udmf-h.md#udmf_visibility) visibility | Data visibility level [Udmf_Visibility](capi-udmf-h.md#udmf_visibility).| 511 512**Returns** 513 514| Type| Description| 515| -- | -- | 516| int | Execution result. For details, see [Udmf_ErrCode](capi-udmf-err-code-h.md#udmf_errcode).<br> Returns **UDMF_E_OK** if the operation is successful.<br> Returns **UDMF_E_INVALID_PARAM** if an invalid parameter is passed in.| 517 518### UDMF_KEY_BUFFER_LEN() 519 520``` 521UDMF_KEY_BUFFER_LEN (512) 522``` 523 524**Description** 525 526Defines minimum length of the buffer that holds the key (unique identifier) of a unified data object. 527 528**Since**: 12 529 530### OH_Udmf_DataProgressListener() 531 532``` 533typedef void (*OH_Udmf_DataProgressListener)(OH_Udmf_ProgressInfo* progressInfo, OH_UdmfData* data) 534``` 535 536**Description** 537 538Defines the callback used to return the data retrieval progress information and data obtained.<br>A null pointer is returned if the progress is less than 100%. The data obtained is returned only when the progress reaches 100%. 539 540**Since**: 15 541 542 543**Parameters** 544 545| Name| Description| 546| -- | -- | 547| [OH_Udmf_ProgressInfo](capi-udmf-oh-udmf-progressinfo.md)* progressInfo | Progress information obtained.| 548| [OH_UdmfData](capi-udmf-oh-udmfdata.md)* data | Data obtained.| 549 550### OH_UdmfData_Create() 551 552``` 553OH_UdmfData* OH_UdmfData_Create() 554``` 555 556**Description** 557 558Creates an [OH_UdmfData](capi-udmf-oh-udmfdata.md) instance and a pointer to it. If this pointer is no longer required, use [OH_UdmfData_Destroy](capi-udmf-h.md#oh_udmfdata_destroy) to destroy it. Otherwise, memory leaks may occur. 559 560**Since**: 12 561 562**Returns** 563 564| Type| Description| 565| -- | -- | 566| [OH_UdmfData](capi-udmf-oh-udmfdata.md)* | Returns a pointer to the [OH_UdmfData](capi-udmf-oh-udmfdata.md) instance created if the operation is successful; returns **nullptr** otherwise.| 567 568**See** 569 570OH_UdmfData 571 572### OH_UdmfData_Destroy() 573 574``` 575void OH_UdmfData_Destroy(OH_UdmfData* pThis) 576``` 577 578**Description** 579 580Destroys an [OH_UdmfData](capi-udmf-oh-udmfdata.md) instance. 581 582**Since**: 12 583 584 585**Parameters** 586 587| Name| Description| 588| -- | -- | 589| [OH_UdmfData](capi-udmf-oh-udmfdata.md)* pThis | Pointer to the [OH_UdmfData](../apis-arkdata/capi-udmf-oh-udmfdata.md) instance.| 590 591**See** 592 593OH_UdmfData 594 595### OH_UdmfData_AddRecord() 596 597``` 598int OH_UdmfData_AddRecord(OH_UdmfData* pThis, OH_UdmfRecord* record) 599``` 600 601**Description** 602 603Adds an [OH_UdmfRecord](capi-udmf-oh-udmfrecord.md) to an [OH_UdmfData](capi-udmf-oh-udmfdata.md) instance. 604 605**Since**: 12 606 607 608**Parameters** 609 610| Name| Description| 611| -- | -- | 612| [OH_UdmfData](capi-udmf-oh-udmfdata.md)* pThis | Pointer to the [OH_UdmfData](../apis-arkdata/capi-udmf-oh-udmfdata.md) instance.| 613| [OH_UdmfRecord](capi-udmf-oh-udmfrecord.md)* record | Pointer to the [OH_UdmfRecord](capi-udmf-oh-udmfrecord.md) instance.| 614 615**Returns** 616 617| Type| Description| 618| -- | -- | 619| int | Error code. For details, see [Udmf_ErrCode](capi-udmf-err-code-h.md#udmf_errcode).<br>Returns **UDMF_E_OK** if the operation is successful.<br>Returns **UDMF_E_INVALID_PARAM** if an invalid parameter is passed in.| 620 621### OH_UdmfData_HasType() 622 623``` 624bool OH_UdmfData_HasType(OH_UdmfData* pThis, const char* type) 625``` 626 627**Description** 628 629Checks whether the specified type exists in an [OH_UdmfData](capi-udmf-oh-udmfdata.md) instance. 630 631**Since**: 12 632 633 634**Parameters** 635 636| Name| Description| 637| -- | -- | 638| [OH_UdmfData](capi-udmf-oh-udmfdata.md)* pThis | Pointer to the [OH_UdmfData](../apis-arkdata/capi-udmf-oh-udmfdata.md) instance.| 639| const char* type | Pointer to the type to check.| 640 641**Returns** 642 643| Type| Description| 644| -- | -- | 645| bool | Check result. The value **true** means the **OH_UdmfData** instance contains the specified type; the value **false** means the opposite.| 646 647### OH_UdmfData_GetTypes() 648 649``` 650char** OH_UdmfData_GetTypes(OH_UdmfData* pThis, unsigned int* count) 651``` 652 653**Description** 654 655Obtains all data types in an [OH_UdmfData](capi-udmf-oh-udmfdata.md) instance. 656 657**Since**: 12 658 659 660**Parameters** 661 662| Name| Description| 663| -- | -- | 664| [OH_UdmfData](capi-udmf-oh-udmfdata.md)* pThis | Pointer to the [OH_UdmfData](../apis-arkdata/capi-udmf-oh-udmfdata.md) instance.| 665| unsigned int* count | Pointer to the number of data types obtained.| 666 667**Returns** 668 669| Type| Description| 670| -- | -- | 671| char** | Returns the data types obtained if the operation is successful; returns **nullptr** otherwise.| 672 673### OH_UdmfData_GetRecords() 674 675``` 676OH_UdmfRecord** OH_UdmfData_GetRecords(OH_UdmfData* pThis, unsigned int* count) 677``` 678 679**Description** 680 681Obtains all records contained in an [OH_UdmfData](capi-udmf-oh-udmfdata.md) instance. 682 683**Since**: 12 684 685 686**Parameters** 687 688| Name| Description| 689| -- | -- | 690| [OH_UdmfData](capi-udmf-oh-udmfdata.md)* pThis | Pointer to the [OH_UdmfData](../apis-arkdata/capi-udmf-oh-udmfdata.md) instance.| 691| unsigned int* count | Pointer to the number of records obtained.| 692 693**Returns** 694 695| Type| Description| 696| -- | -- | 697| [OH_UdmfRecord](capi-udmf-oh-udmfrecord.md)** | Returns a pointer to the [OH_UdmfRecord](capi-udmf-oh-udmfrecord.md) instance created if the operation is successful; returns **nullptr** otherwise.| 698 699### UdmfData_Finalize() 700 701``` 702typedef void (*UdmfData_Finalize)(void* context) 703``` 704 705**Description** 706 707Defines a callback function used to release the context. This callback is invoked when the **OH_UdmfRecordProvider** instance is destroyed. 708 709**Since**: 13 710 711**Parameters** 712 713| Name| Description| 714| -- | -- | 715| void* context | Pointer to the context to release.| 716 717### OH_UdmfRecordProvider_Create() 718 719``` 720OH_UdmfRecordProvider* OH_UdmfRecordProvider_Create() 721``` 722 723**Description** 724 725Creates an [OH_UdmfRecordProvider](capi-udmf-oh-udmfrecordprovider.md) instance and a pointer to it. If this pointer is no longer required, use [OH_UdmfRecordProvider_Destroy](capi-udmf-h.md#oh_udmfrecordprovider_destroy) to destroy it. Otherwise, memory leaks may occur. 726 727**Since**: 13 728 729**Returns** 730 731| Type| Description| 732| -- | -- | 733| [OH_UdmfRecordProvider](capi-udmf-oh-udmfrecordprovider.md)* | Returns a pointer to the [OH_UdmfRecordProvider](capi-udmf-oh-udmfrecordprovider.md) instance created if the operation is successful; returns **nullptr** otherwise.| 734 735### OH_UdmfRecordProvider_Destroy() 736 737``` 738int OH_UdmfRecordProvider_Destroy(OH_UdmfRecordProvider* provider) 739``` 740 741**Description** 742 743Destroys an [OH_UdmfRecordProvider](capi-udmf-oh-udmfrecordprovider.md) instance. 744 745**Since**: 13 746 747 748**Parameters** 749 750| Name| Description| 751| -- | -- | 752| [OH_UdmfRecordProvider](capi-udmf-oh-udmfrecordprovider.md)* provider | Pointer to the [OH_UdmfRecordProvider](capi-udmf-oh-udmfrecordprovider.md) instance.| 753 754**Returns** 755 756| Type| Description| 757| -- | -- | 758| int | Error code. For details, see [Udmf_ErrCode](capi-udmf-err-code-h.md#udmf_errcode).<br>Returns **UDMF_E_OK** if the operation is successful.<br>Returns **UDMF_E_INVALID_PARAM** if an invalid parameter is passed in.| 759 760### OH_UdmfRecordProvider_GetData() 761 762``` 763typedef void* (*OH_UdmfRecordProvider_GetData)(void* context, const char* type) 764``` 765 766**Description** 767 768Defines a callback function used to obtain data by type. This callback will be invoked to return the data obtained from **OH_UdmfRecord**. 769 770**Since**: 13 771 772 773**Parameters** 774 775| Name| Description| 776| -- | -- | 777| void* context | Pointer to the context set by [OH_UdmfRecordProvider_SetData](capi-udmf-h.md#oh_udmfrecordprovider_setdata).| 778| const char* type | Pointer to the type of the data to obtain. For details, see [udmf_meta.h](capi-udmf-meta-h.md).| 779 780**Returns** 781 782| Type| Description| 783| -- | -- | 784| void* | Uniform data obtained.| 785 786### OH_UdmfRecordProvider_SetData() 787 788``` 789int OH_UdmfRecordProvider_SetData(OH_UdmfRecordProvider* provider, void* context, const OH_UdmfRecordProvider_GetData callback, const UdmfData_Finalize finalize) 790``` 791 792**Description** 793 794Sets a callback for an **OH_UdmfRecordProvider** instance to provide data. 795 796**Since**: 13 797 798 799**Parameters** 800 801| Name| Description| 802| -- | -- | 803| [OH_UdmfRecordProvider](capi-udmf-oh-udmfrecordprovider.md)* provider | Pointer to the [OH_UdmfRecordProvider](capi-udmf-oh-udmfrecordprovider.md) instance.| 804| void* context | Pointer to the context, which is passed as the first parameter to [OH_UdmfRecordProvider_GetData](capi-udmf-h.md#oh_udmfrecordprovider_getdata).| 805| const [OH_UdmfRecordProvider_GetData](#oh_udmfrecordprovider_getdata) callback | Callback used to obtain data. For details, see [OH_UdmfRecordProvider_GetData](capi-udmf-h.md#oh_udmfrecordprovider_getdata).| 806| const [UdmfData_Finalize](#udmfdata_finalize) finalize | Optional callback used to release the context data when the **OH_UdmfRecordProvider** instance is destroyed. For details, see [UdmfData_Finalize](capi-udmf-h.md#udmfdata_finalize).| 807 808**Returns** 809 810| Type| Description| 811| -- | -- | 812| int | Error code. For details, see [Udmf_ErrCode](capi-udmf-err-code-h.md#udmf_errcode).<br>Returns **UDMF_E_OK** if the operation is successful.<br>Returns **UDMF_E_INVALID_PARAM** if an invalid parameter is passed in.| 813 814### OH_UdmfRecord_Create() 815 816``` 817OH_UdmfRecord* OH_UdmfRecord_Create() 818``` 819 820**Description** 821 822Creates an [OH_UdmfRecord](capi-udmf-oh-udmfrecord.md) instance and a pointer to it. If this pointer is no longer required, use [OH_UdmfRecord_Destroy](capi-udmf-h.md#oh_udmfrecord_destroy) to destroy it. Otherwise, memory leaks may occur. 823 824**Since**: 12 825 826**Returns** 827 828| Type| Description| 829| -- | -- | 830| [OH_UdmfRecord](capi-udmf-oh-udmfrecord.md)* | Returns a pointer to the [OH_UdmfRecord](capi-udmf-oh-udmfrecord.md) instance created if the operation is successful; returns **nullptr** otherwise.| 831 832### OH_UdmfRecord_Destroy() 833 834``` 835void OH_UdmfRecord_Destroy(OH_UdmfRecord* pThis) 836``` 837 838**Description** 839 840Destroys an [OH_UdmfRecord](capi-udmf-oh-udmfrecord.md) instance. 841 842**Since**: 12 843 844 845**Parameters** 846 847| Name| Description| 848| -- | -- | 849| [OH_UdmfRecord](capi-udmf-oh-udmfrecord.md)* pThis | Pointer to the [OH_UdmfRecord](capi-udmf-oh-udmfrecord.md) instance.| 850 851### OH_UdmfRecord_AddGeneralEntry() 852 853``` 854int OH_UdmfRecord_AddGeneralEntry(OH_UdmfRecord* pThis, const char* typeId, unsigned char* entry, unsigned int count) 855``` 856 857**Description** 858 859Adds customized general data to an [OH_UdmfRecord](capi-udmf-oh-udmfrecord.md) instance. This API cannot be used to add data of UDS types (such as PlainText, Link, and Pixelmap). 860 861**Since**: 12 862 863 864**Parameters** 865 866| Name| Description| 867| -- | -- | 868| [OH_UdmfRecord](capi-udmf-oh-udmfrecord.md)* pThis | Pointer to the [OH_UdmfRecord](capi-udmf-oh-udmfrecord.md) instance.| 869| const char* typeId | Pointer to the data type identifier, which is used to distinguish custom data types from system-defined types. It is recommended that the value start with 'ApplicationDefined'.| 870| unsigned char* entry | Pointer to the customized data to add.| 871| unsigned int count | Size of customized data to add. The data size cannot exceed 4 KB.| 872 873**Returns** 874 875| Type| Description| 876| -- | -- | 877| int | Error code. For details, see [Udmf_ErrCode](capi-udmf-err-code-h.md#udmf_errcode).<br>Returns **UDMF_E_OK** if the operation is successful.<br>Returns **UDMF_E_INVALID_PARAM** if an invalid parameter is passed in.| 878 879### OH_UdmfRecord_AddPlainText() 880 881``` 882int OH_UdmfRecord_AddPlainText(OH_UdmfRecord* pThis, OH_UdsPlainText* plainText) 883``` 884 885**Description** 886 887Adds data of the [OH_UdsPlainText](capi-udmf-oh-udsplaintext.md) type to an [OH_UdmfRecord](capi-udmf-oh-udmfrecord.md) instance. 888 889**Since**: 12 890 891 892**Parameters** 893 894| Name| Description| 895| -- | -- | 896| [OH_UdmfRecord](capi-udmf-oh-udmfrecord.md)* pThis | Pointer to the [OH_UdmfRecord](capi-udmf-oh-udmfrecord.md) instance.| 897| [OH_UdsPlainText](capi-udmf-oh-udsplaintext.md)* plainText | Pointer to the [OH_UdsPlainText](capi-udmf-oh-udsplaintext.md) instance.| 898 899**Returns** 900 901| Type| Description| 902| -- | -- | 903| int | Error code. For details, see [Udmf_ErrCode](capi-udmf-err-code-h.md#udmf_errcode).<br>Returns **UDMF_E_OK** if the operation is successful.<br>Returns **UDMF_E_INVALID_PARAM** if an invalid parameter is passed in.| 904 905### OH_UdmfRecord_AddHyperlink() 906 907``` 908int OH_UdmfRecord_AddHyperlink(OH_UdmfRecord* pThis, OH_UdsHyperlink* hyperlink) 909``` 910 911**Description** 912 913Adds data of the [OH_UdsHyperlink](capi-udmf-oh-udshyperlink.md) type to an [OH_UdmfRecord](capi-udmf-oh-udmfrecord.md) instance. 914 915**Since**: 12 916 917 918**Parameters** 919 920| Name| Description| 921| -- | -- | 922| [OH_UdmfRecord](capi-udmf-oh-udmfrecord.md)* pThis | Pointer to the [OH_UdmfRecord](capi-udmf-oh-udmfrecord.md) instance.| 923| [OH_UdsHyperlink](capi-udmf-oh-udshyperlink.md)* hyperlink | Pointer to the [OH_UdsHyperlink](capi-udmf-oh-udshyperlink.md) instance.| 924 925**Returns** 926 927| Type| Description| 928| -- | -- | 929| int | Error code. For details, see [Udmf_ErrCode](capi-udmf-err-code-h.md#udmf_errcode).<br>Returns **UDMF_E_OK** if the operation is successful.<br>Returns **UDMF_E_INVALID_PARAM** if an invalid parameter is passed in.| 930 931### OH_UdmfRecord_AddHtml() 932 933``` 934int OH_UdmfRecord_AddHtml(OH_UdmfRecord* pThis, OH_UdsHtml* html) 935``` 936 937**Description** 938 939Adds data of the [OH_UdsHtml](capi-udmf-oh-udshtml.md) type to an [OH_UdmfRecord](capi-udmf-oh-udmfrecord.md) instance. 940 941**Since**: 12 942 943 944**Parameters** 945 946| Name| Description| 947| -- | -- | 948| [OH_UdmfRecord](capi-udmf-oh-udmfrecord.md)* pThis | Pointer to the [OH_UdmfRecord](capi-udmf-oh-udmfrecord.md) instance.| 949| [OH_UdsHtml](capi-udmf-oh-udshtml.md)* html | Pointer to the [OH_UdsHtml](capi-udmf-oh-udshtml.md) instance.| 950 951**Returns** 952 953| Type| Description| 954| -- | -- | 955| int | Error code. For details, see [Udmf_ErrCode](capi-udmf-err-code-h.md#udmf_errcode).<br>Returns **UDMF_E_OK** if the operation is successful.<br>Returns **UDMF_E_INVALID_PARAM** if an invalid parameter is passed in.| 956 957### OH_UdmfRecord_AddAppItem() 958 959``` 960int OH_UdmfRecord_AddAppItem(OH_UdmfRecord* pThis, OH_UdsAppItem* appItem) 961``` 962 963**Description** 964 965Adds data of the [OH_UdsAppItem](capi-udmf-oh-udsappitem.md) type to an [OH_UdmfRecord](capi-udmf-oh-udmfrecord.md) instance. 966 967**Since**: 12 968 969 970**Parameters** 971 972| Name| Description| 973| -- | -- | 974| [OH_UdmfRecord](capi-udmf-oh-udmfrecord.md)* pThis | Pointer to the [OH_UdmfRecord](capi-udmf-oh-udmfrecord.md) instance.| 975| [OH_UdsAppItem](capi-udmf-oh-udsappitem.md)* appItem | Pointer to the [OH_UdsAppItem](capi-udmf-oh-udsappitem.md) instance.| 976 977**Returns** 978 979| Type| Description| 980| -- | -- | 981| int | Error code. For details, see [Udmf_ErrCode](capi-udmf-err-code-h.md#udmf_errcode).<br>Returns **UDMF_E_OK** if the operation is successful.<br>Returns **UDMF_E_INVALID_PARAM** if an invalid parameter is passed in.| 982 983### OH_UdmfRecord_AddFileUri() 984 985``` 986int OH_UdmfRecord_AddFileUri(OH_UdmfRecord* pThis, OH_UdsFileUri* fileUri) 987``` 988 989**Description** 990 991Adds data of the [OH_UdsFileUri](capi-udmf-oh-udsfileuri.md) type to an [OH_UdmfRecord](capi-udmf-oh-udmfrecord.md) instance. 992 993**Since**: 13 994 995 996**Parameters** 997 998| Name| Description| 999| -- | -- | 1000| [OH_UdmfRecord](capi-udmf-oh-udmfrecord.md)* pThis | Pointer to the [OH_UdmfRecord](capi-udmf-oh-udmfrecord.md) instance.| 1001| [OH_UdsFileUri](capi-udmf-oh-udsfileuri.md)* fileUri | Pointer to the [OH_UdsFileUri](capi-udmf-oh-udsfileuri.md) instance.| 1002 1003**Returns** 1004 1005| Type| Description| 1006| -- | -- | 1007| int | Error code. For details, see [Udmf_ErrCode](capi-udmf-err-code-h.md#udmf_errcode).<br>Returns **UDMF_E_OK** if the operation is successful.<br>Returns **UDMF_E_INVALID_PARAM** if an invalid parameter is passed in.| 1008 1009### OH_UdmfRecord_AddPixelMap() 1010 1011``` 1012int OH_UdmfRecord_AddPixelMap(OH_UdmfRecord* pThis, OH_UdsPixelMap* pixelMap) 1013``` 1014 1015**Description** 1016 1017Adds data of the [OH_UdsPixelMap](capi-udmf-oh-udspixelmap.md) type to an [OH_UdmfRecord](capi-udmf-oh-udmfrecord.md) instance. 1018 1019**Since**: 13 1020 1021 1022**Parameters** 1023 1024| Name| Description| 1025| -- | -- | 1026| [OH_UdmfRecord](capi-udmf-oh-udmfrecord.md)* pThis | Pointer to the [OH_UdmfRecord](capi-udmf-oh-udmfrecord.md) instance.| 1027| [OH_UdsPixelMap](capi-udmf-oh-udspixelmap.md)* pixelMap | Pointer to the [OH_UdsPixelMap](capi-udmf-oh-udspixelmap.md) instance.| 1028 1029**Returns** 1030 1031| Type| Description| 1032| -- | -- | 1033| int | Error code. For details, see [Udmf_ErrCode](capi-udmf-err-code-h.md#udmf_errcode).<br>Returns **UDMF_E_OK** if the operation is successful.<br>Returns **UDMF_E_INVALID_PARAM** if an invalid parameter is passed in.| 1034 1035### OH_UdmfRecord_AddArrayBuffer() 1036 1037``` 1038int OH_UdmfRecord_AddArrayBuffer(OH_UdmfRecord* record, const char* type, OH_UdsArrayBuffer* buffer) 1039``` 1040 1041**Description** 1042 1043Adds data of the [OH_UdsArrayBuffer](capi-udmf-oh-udsarraybuffer.md) type to an [OH_UdmfRecord](capi-udmf-oh-udmfrecord.md) instance. 1044 1045**Since**: 13 1046 1047 1048**Parameters** 1049 1050| Name| Description| 1051| -- | -- | 1052| [OH_UdmfRecord](capi-udmf-oh-udmfrecord.md)* record | Pointer to the [OH_UdmfRecord](capi-udmf-oh-udmfrecord.md) instance.| 1053| const char* type | Pointer to the ArrayBuffer type ID, which must be unique.| 1054| [OH_UdsArrayBuffer](capi-udmf-oh-udsarraybuffer.md)* buffer | Pointer to the [OH_UdsArrayBuffer](capi-udmf-oh-udsarraybuffer.md) instance.| 1055 1056**Returns** 1057 1058| Type| Description| 1059| -- | -- | 1060| int | Error code. For details, see [Udmf_ErrCode](capi-udmf-err-code-h.md#udmf_errcode).<br>Returns **UDMF_E_OK** if the operation is successful.<br>Returns **UDMF_E_INVALID_PARAM** if an invalid parameter is passed in.| 1061 1062### OH_UdmfRecord_AddContentForm() 1063 1064``` 1065int OH_UdmfRecord_AddContentForm(OH_UdmfRecord* pThis, OH_UdsContentForm* contentForm) 1066``` 1067 1068**Description** 1069 1070Adds data of the [OH_UdsContentForm](capi-udmf-oh-udscontentform.md) type to an [OH_UdmfRecord](capi-udmf-oh-udmfrecord.md) instance. 1071 1072**Since**: 14 1073 1074 1075**Parameters** 1076 1077| Name| Description| 1078| -- | -- | 1079| [OH_UdmfRecord](capi-udmf-oh-udmfrecord.md)* pThis | Pointer to the [OH_UdmfRecord](capi-udmf-oh-udmfrecord.md) instance.| 1080| [OH_UdsContentForm](capi-udmf-oh-udscontentform.md)* contentForm | Pointer to the [OH_UdsContentForm](capi-udmf-oh-udscontentform.md) instance.| 1081 1082**Returns** 1083 1084| Type| Description| 1085| -- | -- | 1086| int | Error code. For details, see [Udmf_ErrCode](capi-udmf-err-code-h.md#udmf_errcode).<br>Returns **UDMF_E_OK** if the operation is successful.<br>Returns **UDMF_E_INVALID_PARAM** if an invalid parameter is passed in.| 1087 1088### OH_UdmfRecord_GetTypes() 1089 1090``` 1091char** OH_UdmfRecord_GetTypes(OH_UdmfRecord* pThis, unsigned int* count) 1092``` 1093 1094**Description** 1095 1096Obtains all data types in an [OH_UdmfRecord](capi-udmf-oh-udmfrecord.md) instance. 1097 1098**Since**: 12 1099 1100 1101**Parameters** 1102 1103| Name| Description| 1104| -- | -- | 1105| [OH_UdmfRecord](capi-udmf-oh-udmfrecord.md)* pThis | Pointer to the [OH_UdmfRecord](capi-udmf-oh-udmfrecord.md) instance.| 1106| unsigned int* count | Pointer to the number of data types obtained.| 1107 1108**Returns** 1109 1110| Type| Description| 1111| -- | -- | 1112| char** | Returns a list of data types obtained if the operation is successful; returns **nullptr** otherwise.| 1113 1114### OH_UdmfRecord_GetGeneralEntry() 1115 1116``` 1117int OH_UdmfRecord_GetGeneralEntry(OH_UdmfRecord* pThis, const char* typeId, unsigned char** entry, unsigned int* count) 1118``` 1119 1120**Description** 1121 1122Obtains the data of the specified type in an [OH_UdmfRecord](capi-udmf-oh-udmfrecord.md) instance. 1123 1124**Since**: 12 1125 1126 1127**Parameters** 1128 1129| Name| Description| 1130| -- | -- | 1131| [OH_UdmfRecord](capi-udmf-oh-udmfrecord.md)* pThis | Pointer to the [OH_UdmfRecord](capi-udmf-oh-udmfrecord.md) instance.| 1132| const char* typeId | Pointer to the data type ID.| 1133| unsigned char** entry | Double pointer to the data obtained.| 1134| unsigned int* count | Pointer to the length of the data obtained.| 1135 1136**Returns** 1137 1138| Type| Description| 1139| -- | -- | 1140| int | Error code. For details, see [Udmf_ErrCode](capi-udmf-err-code-h.md#udmf_errcode).<br>Returns **UDMF_E_OK** if the operation is successful.<br>Returns **UDMF_E_INVALID_PARAM** if an invalid parameter is passed in.<br>Returns **UDMF_ERR** if an internal data error occurs.| 1141 1142### OH_UdmfRecord_GetPlainText() 1143 1144``` 1145int OH_UdmfRecord_GetPlainText(OH_UdmfRecord* pThis, OH_UdsPlainText* plainText) 1146``` 1147 1148**Description** 1149 1150Obtains [OH_UdsPlainText](capi-udmf-oh-udsplaintext.md) data from an [OH_UdmfRecord](capi-udmf-oh-udmfrecord.md) instance. 1151 1152**Since**: 12 1153 1154 1155**Parameters** 1156 1157| Name| Description| 1158| -- | -- | 1159| [OH_UdmfRecord](capi-udmf-oh-udmfrecord.md)* pThis | Pointer to the [OH_UdmfRecord](capi-udmf-oh-udmfrecord.md) instance.| 1160| [OH_UdsPlainText](capi-udmf-oh-udsplaintext.md)* plainText | Pointer to the [OH_UdsPlainText](capi-udmf-oh-udsplaintext.md) instance.| 1161 1162**Returns** 1163 1164| Type| Description| 1165| -- | -- | 1166| int | Error code. For details, see [Udmf_ErrCode](capi-udmf-err-code-h.md#udmf_errcode).<br>Returns **UDMF_E_OK** if the operation is successful.<br>Returns **UDMF_E_INVALID_PARAM** if an invalid parameter is passed in.<br>Returns **UDMF_ERR** if an internal data error occurs.| 1167 1168### OH_UdmfRecord_GetHyperlink() 1169 1170``` 1171int OH_UdmfRecord_GetHyperlink(OH_UdmfRecord* pThis, OH_UdsHyperlink* hyperlink) 1172``` 1173 1174**Description** 1175 1176Obtains [OH_UdsHyperlink](capi-udmf-oh-udshyperlink.md) data from an [OH_UdmfRecord](capi-udmf-oh-udmfrecord.md) instance. 1177 1178**Since**: 12 1179 1180 1181**Parameters** 1182 1183| Name| Description| 1184| -- | -- | 1185| [OH_UdmfRecord](capi-udmf-oh-udmfrecord.md)* pThis | Pointer to the [OH_UdmfRecord](capi-udmf-oh-udmfrecord.md) instance.| 1186| [OH_UdsHyperlink](capi-udmf-oh-udshyperlink.md)* hyperlink | Pointer to the [OH_UdsHyperlink](capi-udmf-oh-udshyperlink.md) instance.| 1187 1188**Returns** 1189 1190| Type| Description| 1191| -- | -- | 1192| int | Error code. For details, see [Udmf_ErrCode](capi-udmf-err-code-h.md#udmf_errcode).<br>Returns **UDMF_E_OK** if the operation is successful.<br>Returns **UDMF_E_INVALID_PARAM** if an invalid parameter is passed in.<br>Returns **UDMF_ERR** if an internal data error occurs.| 1193 1194### OH_UdmfRecord_GetHtml() 1195 1196``` 1197int OH_UdmfRecord_GetHtml(OH_UdmfRecord* pThis, OH_UdsHtml* html) 1198``` 1199 1200**Description** 1201 1202Obtains [OH_UdsHtml](capi-udmf-oh-udshtml.md) data from an [OH_UdmfRecord](capi-udmf-oh-udmfrecord.md) instance. 1203 1204**Since**: 12 1205 1206 1207**Parameters** 1208 1209| Name| Description| 1210| -- | -- | 1211| [OH_UdmfRecord](capi-udmf-oh-udmfrecord.md)* pThis | Pointer to the [OH_UdmfRecord](capi-udmf-oh-udmfrecord.md) instance.| 1212| [OH_UdsHtml](capi-udmf-oh-udshtml.md)* html | Pointer to the [OH_UdsHtml](capi-udmf-oh-udshtml.md) instance.| 1213 1214**Returns** 1215 1216| Type| Description| 1217| -- | -- | 1218| int | Error code. For details, see [Udmf_ErrCode](capi-udmf-err-code-h.md#udmf_errcode).<br>Returns **UDMF_E_OK** if the operation is successful.<br>Returns **UDMF_E_INVALID_PARAM** if an invalid parameter is passed in.<br>Returns **UDMF_ERR** if an internal data error occurs.| 1219 1220### OH_UdmfRecord_GetAppItem() 1221 1222``` 1223int OH_UdmfRecord_GetAppItem(OH_UdmfRecord* pThis, OH_UdsAppItem* appItem) 1224``` 1225 1226**Description** 1227 1228Obtains [OH_UdsAppItem](capi-udmf-oh-udsappitem.md) data from an [OH_UdmfRecord](capi-udmf-oh-udmfrecord.md) instance. 1229 1230**Since**: 12 1231 1232 1233**Parameters** 1234 1235| Name| Description| 1236| -- | -- | 1237| [OH_UdmfRecord](capi-udmf-oh-udmfrecord.md)* pThis | Pointer to the [OH_UdmfRecord](capi-udmf-oh-udmfrecord.md) instance.| 1238| [OH_UdsAppItem](capi-udmf-oh-udsappitem.md)* appItem | Pointer to the [OH_UdsAppItem](capi-udmf-oh-udsappitem.md) instance.| 1239 1240**Returns** 1241 1242| Type| Description| 1243| -- | -- | 1244| int | Error code. For details, see [Udmf_ErrCode](capi-udmf-err-code-h.md#udmf_errcode).<br>Returns **UDMF_E_OK** if the operation is successful.<br>Returns **UDMF_E_INVALID_PARAM** if an invalid parameter is passed in.<br>Returns **UDMF_ERR** if an internal data error occurs.| 1245 1246### OH_UdmfRecord_SetProvider() 1247 1248``` 1249int OH_UdmfRecord_SetProvider(OH_UdmfRecord* pThis, const char* const* types, unsigned int count, OH_UdmfRecordProvider* provider) 1250``` 1251 1252**Description** 1253 1254Sets the [OH_UdmfRecordProvider](capi-udmf-oh-udmfrecordprovider.md) in an [OH_UdmfRecord](capi-udmf-oh-udmfrecord.md) instance. 1255 1256**Since**: 13 1257 1258 1259**Parameters** 1260 1261| Name| Description| 1262| -- | -- | 1263| [OH_UdmfRecord](capi-udmf-oh-udmfrecord.md)* pThis | Pointer to the [OH_UdmfRecord](capi-udmf-oh-udmfrecord.md) instance.| 1264| const char* const* types | Pointer to the data types to be provided.| 1265| unsigned int count | Number of the data types.| 1266| [OH_UdmfRecordProvider](capi-udmf-oh-udmfrecordprovider.md)* provider | Pointer to the [OH_UdmfRecordProvider](capi-udmf-oh-udmfrecordprovider.md) instance.| 1267 1268**Returns** 1269 1270| Type| Description| 1271| -- | -- | 1272| int | Error code. For details, see [Udmf_ErrCode](capi-udmf-err-code-h.md#udmf_errcode).<br>Returns **UDMF_E_OK** if the operation is successful.<br>Returns **UDMF_E_INVALID_PARAM** if an invalid parameter is passed in.| 1273 1274### OH_UdmfRecord_GetFileUri() 1275 1276``` 1277int OH_UdmfRecord_GetFileUri(OH_UdmfRecord* pThis, OH_UdsFileUri* fileUri) 1278``` 1279 1280**Description** 1281 1282Obtains [OH_UdsFileUri](capi-udmf-oh-udsfileuri.md) data from an [OH_UdmfRecord](capi-udmf-oh-udmfrecord.md) instance. 1283 1284**Since**: 13 1285 1286 1287**Parameters** 1288 1289| Name| Description| 1290| -- | -- | 1291| [OH_UdmfRecord](capi-udmf-oh-udmfrecord.md)* pThis | Pointer to the [OH_UdmfRecord](capi-udmf-oh-udmfrecord.md) instance.| 1292| [OH_UdsFileUri](capi-udmf-oh-udsfileuri.md)* fileUri | Pointer to the [OH_UdsFileUri](capi-udmf-oh-udsfileuri.md) instance.| 1293 1294**Returns** 1295 1296| Type| Description| 1297| -- | -- | 1298| int | Error code. For details, see [Udmf_ErrCode](capi-udmf-err-code-h.md#udmf_errcode).<br>Returns **UDMF_E_OK** if the operation is successful.<br>Returns **UDMF_E_INVALID_PARAM** if an invalid parameter is passed in.| 1299 1300### OH_UdmfRecord_GetPixelMap() 1301 1302``` 1303int OH_UdmfRecord_GetPixelMap(OH_UdmfRecord* pThis, OH_UdsPixelMap* pixelMap) 1304``` 1305 1306**Description** 1307 1308Obtains [OH_UdsPixelMap](capi-udmf-oh-udspixelmap.md) data from an [OH_UdmfRecord](capi-udmf-oh-udmfrecord.md) instance. 1309 1310**Since**: 13 1311 1312 1313**Parameters** 1314 1315| Name| Description| 1316| -- | -- | 1317| [OH_UdmfRecord](capi-udmf-oh-udmfrecord.md)* pThis | Pointer to the [OH_UdmfRecord](capi-udmf-oh-udmfrecord.md) instance.| 1318| [OH_UdsPixelMap](capi-udmf-oh-udspixelmap.md)* pixelMap | Pointer to the [OH_UdsPixelMap](capi-udmf-oh-udspixelmap.md) instance.| 1319 1320**Returns** 1321 1322| Type| Description| 1323| -- | -- | 1324| int | Error code. For details, see [Udmf_ErrCode](capi-udmf-err-code-h.md#udmf_errcode).<br>Returns **UDMF_E_OK** if the operation is successful.<br>Returns **UDMF_E_INVALID_PARAM** if an invalid parameter is passed in.| 1325 1326### OH_UdmfRecord_GetArrayBuffer() 1327 1328``` 1329int OH_UdmfRecord_GetArrayBuffer(OH_UdmfRecord* record, const char* type, OH_UdsArrayBuffer* buffer) 1330``` 1331 1332**Description** 1333 1334Obtains [OH_UdsArrayBuffer](capi-udmf-oh-udsarraybuffer.md) data from an [OH_UdmfRecord](capi-udmf-oh-udmfrecord.md) instance. 1335 1336**Since**: 13 1337 1338 1339**Parameters** 1340 1341| Name| Description| 1342| -- | -- | 1343| [OH_UdmfRecord](capi-udmf-oh-udmfrecord.md)* record | Pointer to the [OH_UdmfRecord](capi-udmf-oh-udmfrecord.md) instance.| 1344| const char* type | Pointer to the data type ID of the ArrayBuffer data to obtain.| 1345| [OH_UdsArrayBuffer](capi-udmf-oh-udsarraybuffer.md)* buffer | Pointer to the [OH_UdsArrayBuffer](capi-udmf-oh-udsarraybuffer.md) instance.| 1346 1347**Returns** 1348 1349| Type| Description| 1350| -- | -- | 1351| int | Error code. For details, see [Udmf_ErrCode](capi-udmf-err-code-h.md#udmf_errcode).<br>Returns **UDMF_E_OK** if the operation is successful.<br>Returns **UDMF_E_INVALID_PARAM** if an invalid parameter is passed in.| 1352 1353### OH_UdmfRecord_GetContentForm() 1354 1355``` 1356int OH_UdmfRecord_GetContentForm(OH_UdmfRecord* pThis, OH_UdsContentForm* contentForm) 1357``` 1358 1359**Description** 1360 1361Obtains [OH_UdsContentForm](capi-udmf-oh-udscontentform.md) data from an [OH_UdmfRecord](capi-udmf-oh-udmfrecord.md) instance. 1362 1363**Since**: 14 1364 1365 1366**Parameters** 1367 1368| Name| Description| 1369| -- | -- | 1370| [OH_UdmfRecord](capi-udmf-oh-udmfrecord.md)* pThis | Pointer to the [OH_UdmfRecord](capi-udmf-oh-udmfrecord.md) instance.| 1371| [OH_UdsContentForm](capi-udmf-oh-udscontentform.md)* contentForm | Pointer to the [OH_UdsContentForm](capi-udmf-oh-udscontentform.md) instance.| 1372 1373**Returns** 1374 1375| Type| Description| 1376| -- | -- | 1377| int | Error code. For details, see [Udmf_ErrCode](capi-udmf-err-code-h.md#udmf_errcode).<br>Returns **UDMF_E_OK** if the operation is successful.<br>Returns **UDMF_E_INVALID_PARAM** if an invalid parameter is passed in.| 1378 1379### OH_UdmfData_GetPrimaryPlainText() 1380 1381``` 1382int OH_UdmfData_GetPrimaryPlainText(OH_UdmfData* data, OH_UdsPlainText* plainText) 1383``` 1384 1385**Description** 1386 1387Obtains the first [OH_UdsPlainText](capi-udmf-oh-udsplaintext.md) data from an [OH_UdmfData](capi-udmf-oh-udmfdata.md) instance. 1388 1389**Since**: 13 1390 1391 1392**Parameters** 1393 1394| Name| Description| 1395| -- | -- | 1396| [OH_UdmfData](capi-udmf-oh-udmfdata.md)* data | Pointer to the [OH_UdmfData](capi-udmf-oh-udmfdata.md) instance.| 1397| [OH_UdsPlainText](capi-udmf-oh-udsplaintext.md)* plainText | Pointer to the [OH_UdsPlainText](capi-udmf-oh-udsplaintext.md) instance.| 1398 1399**Returns** 1400 1401| Type| Description| 1402| -- | -- | 1403| int | Error code. For details, see [Udmf_ErrCode](capi-udmf-err-code-h.md#udmf_errcode).<br>Returns **UDMF_E_OK** if the operation is successful.<br>Returns **UDMF_E_INVALID_PARAM** if an invalid parameter is passed in.| 1404 1405### OH_UdmfData_GetPrimaryHtml() 1406 1407``` 1408int OH_UdmfData_GetPrimaryHtml(OH_UdmfData* data, OH_UdsHtml* html) 1409``` 1410 1411**Description** 1412 1413Obtains the first [OH_UdsHtml](capi-udmf-oh-udshtml.md) data from an [OH_UdmfData](capi-udmf-oh-udmfdata.md) instance. 1414 1415**Since**: 13 1416 1417 1418**Parameters** 1419 1420| Name| Description| 1421| -- | -- | 1422| [OH_UdmfData](capi-udmf-oh-udmfdata.md)* data | Pointer to the [OH_UdmfData](capi-udmf-oh-udmfdata.md) instance.| 1423| [OH_UdsHtml](capi-udmf-oh-udshtml.md)* html | Pointer to the [OH_UdsHtml](capi-udmf-oh-udshtml.md) instance.| 1424 1425**Returns** 1426 1427| Type| Description| 1428| -- | -- | 1429| int | Error code. For details, see [Udmf_ErrCode](capi-udmf-err-code-h.md#udmf_errcode).<br>Returns **UDMF_E_OK** if the operation is successful.<br>Returns **UDMF_E_INVALID_PARAM** if an invalid parameter is passed in.| 1430 1431### OH_UdmfData_GetRecordCount() 1432 1433``` 1434int OH_UdmfData_GetRecordCount(OH_UdmfData* data) 1435``` 1436 1437**Description** 1438 1439Obtains the number of data records contained in an [OH_UdmfData](capi-udmf-oh-udmfdata.md) instance. 1440 1441**Since**: 13 1442 1443 1444**Parameters** 1445 1446| Name| Description| 1447| -- | -- | 1448| [OH_UdmfData](capi-udmf-oh-udmfdata.md)* data | Pointer to the [OH_UdmfData](capi-udmf-oh-udmfdata.md) instance.| 1449 1450**Returns** 1451 1452| Type| Description| 1453| -- | -- | 1454| int | Number of the data records in an [OH_UdmfRecord](capi-udmf-oh-udmfrecord.md) instance obtained.| 1455 1456### OH_UdmfData_GetRecord() 1457 1458``` 1459OH_UdmfRecord* OH_UdmfData_GetRecord(OH_UdmfData* data, unsigned int index) 1460``` 1461 1462**Description** 1463 1464Obtains the specified data record from an [OH_UdmfData](capi-udmf-oh-udmfdata.md) instance. 1465 1466**Since**: 13 1467 1468 1469**Parameters** 1470 1471| Name| Description| 1472| -- | -- | 1473| [OH_UdmfData](capi-udmf-oh-udmfdata.md)* data | Pointer to the [OH_UdmfData](capi-udmf-oh-udmfdata.md) instance.| 1474| unsigned int index | Subscript of the [OH_UdmfRecord](capi-udmf-oh-udmfrecord.md) instance to be obtained in [OH_UdmfData](capi-udmf-oh-udmfdata.md).| 1475 1476**Returns** 1477 1478| Type| Description| 1479| -- | -- | 1480| [OH_UdmfRecord](capi-udmf-oh-udmfrecord.md)* | Returns a pointer to the [OH_UdmfRecord](capi-udmf-oh-udmfrecord.md) instance created if the operation is successful; returns **nullptr** otherwise.| 1481 1482### OH_UdmfData_IsLocal() 1483 1484``` 1485bool OH_UdmfData_IsLocal(OH_UdmfData* data) 1486``` 1487 1488**Description** 1489 1490Checks whether an [OH_UdmfData](capi-udmf-oh-udmfdata.md) instance is from the local device. 1491 1492**Since**: 13 1493 1494 1495**Parameters** 1496 1497| Name| Description| 1498| -- | -- | 1499| [OH_UdmfData](capi-udmf-oh-udmfdata.md)* data | Pointer to the [OH_UdmfData](capi-udmf-oh-udmfdata.md) instance.| 1500 1501**Returns** 1502 1503| Type| Description| 1504| -- | -- | 1505| bool | Check result. The value **true** means the data is from the local device; the value **false** means the opposite.| 1506 1507### OH_UdmfProperty_Create() 1508 1509``` 1510OH_UdmfProperty* OH_UdmfProperty_Create(OH_UdmfData* unifiedData) 1511``` 1512 1513**Description** 1514 1515Creates an [OH_UdmfProperty](capi-udmf-oh-udmfproperty.md) instance and a pointer to it. If this pointer is no longer required, use [OH_UdmfProperty_Destroy](capi-udmf-h.md#oh_udmfproperty_destroy) to destroy it. Otherwise, memory leaks may occur. 1516 1517**Since**: 12 1518 1519 1520**Parameters** 1521 1522| Name| Description| 1523| -- | -- | 1524| [OH_UdmfData](capi-udmf-oh-udmfdata.md)* unifiedData | Pointer to the [OH_UdmfData](capi-udmf-oh-udmfdata.md) instance.| 1525 1526**Returns** 1527 1528| Type| Description| 1529| -- | -- | 1530| [OH_UdmfProperty](capi-udmf-oh-udmfproperty.md)* | Returns a pointer to the [OH_UdmfProperty](capi-udmf-oh-udmfproperty.md) instance created if the operation is successful; returns **nullptr** otherwise.| 1531 1532### OH_UdmfProperty_Destroy() 1533 1534``` 1535void OH_UdmfProperty_Destroy(OH_UdmfProperty* pThis) 1536``` 1537 1538**Description** 1539 1540Destroys an [OH_UdmfProperty](capi-udmf-oh-udmfproperty.md) instance. 1541 1542**Since**: 12 1543 1544 1545**Parameters** 1546 1547| Name| Description| 1548| -- | -- | 1549| [OH_UdmfProperty](capi-udmf-oh-udmfproperty.md)* pThis | Pointer to the [OH_UdmfProperty](capi-udmf-oh-udmfproperty.md) instance.| 1550 1551### OH_UdmfProperty_GetTag() 1552 1553``` 1554const char* OH_UdmfProperty_GetTag(OH_UdmfProperty* pThis) 1555``` 1556 1557**Description** 1558 1559Obtains the custom tag value from an [OH_UdmfProperty](capi-udmf-oh-udmfproperty.md) instance. 1560 1561**Since**: 12 1562 1563 1564**Parameters** 1565 1566| Name| Description| 1567| -- | -- | 1568| [OH_UdmfProperty](capi-udmf-oh-udmfproperty.md)* pThis | Pointer to the [OH_UdmfProperty](capi-udmf-oh-udmfproperty.md) instance.| 1569 1570**Returns** 1571 1572| Type| Description| 1573| -- | -- | 1574| const char* | Returns a pointer to the custom tag value obtained if the operation is successful; returns **nullptr** otherwise.| 1575 1576### OH_UdmfProperty_GetTimestamp() 1577 1578``` 1579int64_t OH_UdmfProperty_GetTimestamp(OH_UdmfProperty* pThis) 1580``` 1581 1582**Description** 1583 1584Obtains the timestamp from an [OH_UdmfProperty](capi-udmf-oh-udmfproperty.md) instance. 1585 1586**Since**: 12 1587 1588 1589**Parameters** 1590 1591| Name| Description| 1592| -- | -- | 1593| [OH_UdmfProperty](capi-udmf-oh-udmfproperty.md)* pThis | Pointer to the [OH_UdmfProperty](capi-udmf-oh-udmfproperty.md) instance.| 1594 1595**Returns** 1596 1597| Type| Description| 1598| -- | -- | 1599| int64_t | Timestamp obtained.| 1600 1601### OH_UdmfProperty_GetShareOption() 1602 1603``` 1604Udmf_ShareOption OH_UdmfProperty_GetShareOption(OH_UdmfProperty* pThis) 1605``` 1606 1607**Description** 1608 1609Obtains the share option from an [OH_UdmfProperty](capi-udmf-oh-udmfproperty.md) instance. 1610 1611**Since**: 12 1612 1613 1614**Parameters** 1615 1616| Name| Description| 1617| -- | -- | 1618| [OH_UdmfProperty](capi-udmf-oh-udmfproperty.md)* pThis | Pointer to the [OH_UdmfProperty](capi-udmf-oh-udmfproperty.md) instance.| 1619 1620**Returns** 1621 1622| Type| Description| 1623| -- | -- | 1624| [Udmf_ShareOption](#udmf_shareoption) | Share option in the [Udmf_ShareOption](capi-udmf-h.md#udmf_shareoption) instance obtained.| 1625 1626### OH_UdmfProperty_GetExtrasIntParam() 1627 1628``` 1629int OH_UdmfProperty_GetExtrasIntParam(OH_UdmfProperty* pThis, const char* key, int defaultValue) 1630``` 1631 1632**Description** 1633 1634Obtains the customized extra integer parameter from an [OH_UdmfProperty](capi-udmf-oh-udmfproperty.md) instance. 1635 1636**Since**: 12 1637 1638 1639**Parameters** 1640 1641| Name| Description| 1642| -- | -- | 1643| [OH_UdmfProperty](capi-udmf-oh-udmfproperty.md)* pThis | Pointer to the [OH_UdmfProperty](capi-udmf-oh-udmfproperty.md) instance.| 1644| const char* key | Pointer to the key of the parameter to set.| 1645| int defaultValue | Default value to be returned if the parameter fails to be obtained.| 1646 1647**Returns** 1648 1649| Type| Description| 1650| -- | -- | 1651| int | Returns the integer value obtained if the operation is successful; returns **defaultValue** if the operation fails.| 1652 1653### OH_UdmfProperty_GetExtrasStringParam() 1654 1655``` 1656const char* OH_UdmfProperty_GetExtrasStringParam(OH_UdmfProperty* pThis, const char* key) 1657``` 1658 1659**Description** 1660 1661Obtains the customized extra string parameter from an [OH_UdmfProperty](capi-udmf-oh-udmfproperty.md) instance. 1662 1663**Since**: 12 1664 1665 1666**Parameters** 1667 1668| Name| Description| 1669| -- | -- | 1670| [OH_UdmfProperty](capi-udmf-oh-udmfproperty.md)* pThis | Pointer to the [OH_UdmfProperty](capi-udmf-oh-udmfproperty.md) instance.| 1671| const char* key | Pointer to the key of the parameter to set.| 1672 1673**Returns** 1674 1675| Type| Description| 1676| -- | -- | 1677| const char* | Returns a pointer to the string value obtained if the operation is successful; returns **nullptr** otherwise.| 1678 1679### OH_UdmfProperty_SetTag() 1680 1681``` 1682int OH_UdmfProperty_SetTag(OH_UdmfProperty* pThis, const char* tag) 1683``` 1684 1685**Description** 1686 1687Sets the tag value for an [OH_UdmfProperty](capi-udmf-oh-udmfproperty.md) instance. 1688 1689**Since**: 12 1690 1691 1692**Parameters** 1693 1694| Name| Description| 1695| -- | -- | 1696| [OH_UdmfProperty](capi-udmf-oh-udmfproperty.md)* pThis | Pointer to the [OH_UdmfProperty](capi-udmf-oh-udmfproperty.md) instance.| 1697| const char* tag | Pointer to the tag value to set.| 1698 1699**Returns** 1700 1701| Type| Description| 1702| -- | -- | 1703| int | Error code. For details, see [Udmf_ErrCode](capi-udmf-err-code-h.md#udmf_errcode).<br>Returns **UDMF_E_OK** if the operation is successful.<br>Returns **UDMF_E_INVALID_PARAM** if an invalid parameter is passed in.| 1704 1705### OH_UdmfProperty_SetShareOption() 1706 1707``` 1708int OH_UdmfProperty_SetShareOption(OH_UdmfProperty* pThis, Udmf_ShareOption option) 1709``` 1710 1711**Description** 1712 1713Sets the [Udmf_ShareOption](capi-udmf-h.md#udmf_shareoption) for an [OH_UdmfProperty](capi-udmf-oh-udmfproperty.md) instance. 1714 1715**Since**: 12 1716 1717 1718**Parameters** 1719 1720| Name| Description| 1721| -- | -- | 1722| [OH_UdmfProperty](capi-udmf-oh-udmfproperty.md)* pThis | Pointer to the [OH_UdmfProperty](capi-udmf-oh-udmfproperty.md) instance.| 1723| [Udmf_ShareOption](#udmf_shareoption) option | Pointer to the [Udmf_ShareOption](capi-udmf-h.md#udmf_shareoption) instance.| 1724 1725**Returns** 1726 1727| Type| Description| 1728| -- | -- | 1729| int | Error code. For details, see [Udmf_ErrCode](capi-udmf-err-code-h.md#udmf_errcode).<br>Returns **UDMF_E_OK** if the operation is successful.<br>Returns **UDMF_E_INVALID_PARAM** if an invalid parameter is passed in.| 1730 1731### OH_UdmfProperty_SetExtrasIntParam() 1732 1733``` 1734int OH_UdmfProperty_SetExtrasIntParam(OH_UdmfProperty* pThis, const char* key, int param) 1735``` 1736 1737**Description** 1738 1739Sets the extra integer parameter for an [OH_UdmfProperty](capi-udmf-oh-udmfproperty.md) instance. 1740 1741**Since**: 12 1742 1743 1744**Parameters** 1745 1746| Name| Description| 1747| -- | -- | 1748| [OH_UdmfProperty](capi-udmf-oh-udmfproperty.md)* pThis | Pointer to the [OH_UdmfRecord](capi-udmf-oh-udmfrecord.md) instance.| 1749| const char* key | Pointer to the key of the parameter to set.| 1750| int param | Parameter value to set.| 1751 1752**Returns** 1753 1754| Type| Description| 1755| -- | -- | 1756| int | Error code. For details, see [Udmf_ErrCode](capi-udmf-err-code-h.md#udmf_errcode).<br>Returns **UDMF_E_OK** if the operation is successful.<br>Returns **UDMF_E_INVALID_PARAM** if an invalid parameter is passed in.| 1757 1758### OH_UdmfProperty_SetExtrasStringParam() 1759 1760``` 1761int OH_UdmfProperty_SetExtrasStringParam(OH_UdmfProperty* pThis, const char* key, const char* param) 1762``` 1763 1764**Description** 1765 1766Sets the extra string parameter for an [OH_UdmfProperty](capi-udmf-oh-udmfproperty.md) instance. 1767 1768**Since**: 12 1769 1770 1771**Parameters** 1772 1773| Name| Description| 1774| -- | -- | 1775| [OH_UdmfProperty](capi-udmf-oh-udmfproperty.md)* pThis | Pointer to the [OH_UdmfRecord](capi-udmf-oh-udmfrecord.md) instance.| 1776| const char* key | Pointer to the key of the parameter to set.| 1777| const char* param | Parameter value to set.| 1778 1779**Returns** 1780 1781| Type| Description| 1782| -- | -- | 1783| int | Error code. For details, see [Udmf_ErrCode](capi-udmf-err-code-h.md#udmf_errcode).<br>Returns **UDMF_E_OK** if the operation is successful.<br>Returns **UDMF_E_INVALID_PARAM** if an invalid parameter is passed in.| 1784 1785### OH_UdmfOptions_Create() 1786 1787``` 1788OH_UdmfOptions* OH_UdmfOptions_Create() 1789``` 1790 1791**Description** 1792 1793Creates an [OH_UdmfOptions](capi-udmf-oh-udmfoptions.md) instance. 1794 1795**Since**: 20 1796 1797**Returns** 1798 1799| Type| Description| 1800| -- | -- | 1801| [OH_UdmfOptions](capi-udmf-oh-udmfoptions.md)* | Returns a pointer to the [OH_UdmfOptions](capi-udmf-oh-udmfoptions.md) instance created if the operation is successful; returns **nullptr** otherwise.| 1802 1803### OH_UdmfOptions_Destroy() 1804 1805``` 1806void OH_UdmfOptions_Destroy(OH_UdmfOptions* pThis) 1807``` 1808 1809**Description** 1810 1811Destroys an [OH_UdmfOptions](capi-udmf-oh-udmfoptions.md) instance. 1812 1813**Since**: 20 1814 1815 1816**Parameters** 1817 1818| Name| Description| 1819| -- | -- | 1820| [OH_UdmfOptions](capi-udmf-oh-udmfoptions.md)* pThis | Pointer to the [OH_UdmfOptions](capi-udmf-oh-udmfoptions.md) instance.| 1821 1822### OH_UdmfOptions_GetKey() 1823 1824``` 1825const char* OH_UdmfOptions_GetKey(OH_UdmfOptions* pThis) 1826``` 1827 1828**Description** 1829 1830Obtains the key (unique identifier) from an [OH_UdmfOptions](capi-udmf-oh-udmfoptions.md) instance. 1831 1832**Since**: 20 1833 1834 1835**Parameters** 1836 1837| Name| Description| 1838| -- | -- | 1839| [OH_UdmfOptions](capi-udmf-oh-udmfoptions.md)* pThis | Pointer to the [OH_UdmfOptions](capi-udmf-oh-udmfoptions.md) instance.| 1840 1841**Returns** 1842 1843| Type| Description| 1844| -- | -- | 1845| const char* | Returns a pointer to the unique identifier obtained if the operation is successful; returns **nullptr** otherwise.| 1846 1847### OH_UdmfOptions_SetKey() 1848 1849``` 1850int OH_UdmfOptions_SetKey(OH_UdmfOptions* pThis, const char* key) 1851``` 1852 1853**Description** 1854 1855Sets the key (unique identifier) in an [OH_UdmfOptions](capi-udmf-oh-udmfoptions.md) instance. 1856 1857**Since**: 20 1858 1859 1860**Parameters** 1861 1862| Name| Description| 1863| -- | -- | 1864| [OH_UdmfOptions](capi-udmf-oh-udmfoptions.md)* pThis | Pointer to the [OH_UdmfOptions](capi-udmf-oh-udmfoptions.md) instance.| 1865| const char* key | Pointer to the value of the unique identifier of the data.| 1866 1867**Returns** 1868 1869| Type| Description| 1870| -- | -- | 1871| int | Error code. For details, see [Udmf_ErrCode](capi-udmf-err-code-h.md#udmf_errcode).<br>Returns **UDMF_E_OK** if the operation is successful.<br>Returns **UDMF_E_INVALID_PARAM** if an invalid parameter is passed in.| 1872 1873### OH_UdmfOptions_GetIntention() 1874 1875``` 1876Udmf_Intention OH_UdmfOptions_GetIntention(OH_UdmfOptions* pThis) 1877``` 1878 1879**Description** 1880 1881Obtains the data channel information from an [OH_UdmfOptions](capi-udmf-oh-udmfoptions.md) instance. 1882 1883**Since**: 20 1884 1885 1886**Parameters** 1887 1888| Name| Description| 1889| -- | -- | 1890| [OH_UdmfOptions](capi-udmf-oh-udmfoptions.md)* pThis | Pointer to the [OH_UdmfOptions](capi-udmf-oh-udmfoptions.md) instance.| 1891 1892**Returns** 1893 1894| Type| Description| 1895| -- | -- | 1896| [Udmf_Intention](#udmf_intention) | Returns the value of [Udmf_Intent](capi-udmf-h.md#udmf_intention).| 1897 1898### OH_UdmfOptions_SetIntention() 1899 1900``` 1901int OH_UdmfOptions_SetIntention(OH_UdmfOptions* pThis, Udmf_Intention intention) 1902``` 1903 1904**Description** 1905 1906Sets the data channel content parameter in an [OH_UdmfOptions](capi-udmf-oh-udmfoptions.md) instance. 1907 1908**Since**: 20 1909 1910 1911**Parameters** 1912 1913| Name| Description| 1914| -- | -- | 1915| [OH_UdmfOptions](capi-udmf-oh-udmfoptions.md)* pThis | Pointer to the [OH_UdmfOptions](capi-udmf-oh-udmfoptions.md) instance.| 1916| [Udmf_Intention](#udmf_intention) intention | Data channel type.| 1917 1918**Returns** 1919 1920| Type| Description| 1921| -- | -- | 1922| int | Error code. For details, see [Udmf_ErrCode](capi-udmf-err-code-h.md#udmf_errcode).<br>Returns **UDMF_E_OK** if the operation is successful.<br>Returns **UDMF_E_INVALID_PARAM** if an invalid parameter is passed in.| 1923 1924### OH_UdmfOptions_Reset() 1925 1926``` 1927int OH_UdmfOptions_Reset(OH_UdmfOptions* pThis) 1928``` 1929 1930**Description** 1931 1932Resets an [OH_UdmfOptions](capi-udmf-oh-udmfoptions.md) instance to empty. 1933 1934**Since**: 20 1935 1936 1937**Parameters** 1938 1939| Name| Description| 1940| -- | -- | 1941| [OH_UdmfOptions](capi-udmf-oh-udmfoptions.md)* pThis | Pointer to the [OH_UdmfOptions](capi-udmf-oh-udmfoptions.md) instance.| 1942 1943**Returns** 1944 1945| Type| Description| 1946| -- | -- | 1947| int | Error code. For details, see [Udmf_ErrCode](capi-udmf-err-code-h.md#udmf_errcode).<br>Returns **UDMF_E_OK** if the operation is successful.<br>Returns **UDMF_E_INVALID_PARAM** if an invalid parameter is passed in.| 1948 1949### OH_Udmf_GetUnifiedData() 1950 1951``` 1952int OH_Udmf_GetUnifiedData(const char* key, Udmf_Intention intention, OH_UdmfData* unifiedData) 1953``` 1954 1955**Description** 1956 1957Obtains an [OH_UdmfData](capi-udmf-oh-udmfdata.md) instance from the UDMF database. 1958 1959**Since**: 12 1960 1961 1962**Parameters** 1963 1964| Name| Description| 1965| -- | -- | 1966| const char* key | Pointer to the unique identifier of the data in the database.| 1967| [Udmf_Intention](#udmf_intention) intention | Data channel type [Udmf_Intent](capi-udmf-h.md#udmf_intention).| 1968| [OH_UdmfData](capi-udmf-oh-udmfdata.md)* unifiedData | Pointer to the [OH_UdmfData](capi-udmf-oh-udmfdata.md) instance obtained.| 1969 1970**Returns** 1971 1972| Type| Description| 1973| -- | -- | 1974| int | Error code. For details, see [Udmf_ErrCode](capi-udmf-err-code-h.md#udmf_errcode).<br>Returns **UDMF_E_OK** if the operation is successful.<br>Returns **UDMF_E_INVALID_PARAM** if an invalid parameter is passed in.<br>Returns **UDMF_ERR** if an internal data error occurs.| 1975 1976### OH_Udmf_GetUnifiedDataByOptions() 1977 1978``` 1979int OH_Udmf_GetUnifiedDataByOptions(OH_UdmfOptions* options, OH_UdmfData** dataArray, unsigned int* dataSize) 1980``` 1981 1982**Description** 1983 1984Obtains an [OH_UdmfData](capi-udmf-oh-udmfdata.md) instance from the UDMF database by data channel type. 1985 1986**Since**: 20 1987 1988 1989**Parameters** 1990 1991| Name| Description| 1992| -- | -- | 1993| [OH_UdmfOptions](capi-udmf-oh-udmfoptions.md)* options | Pointer to the [OH_UdmfOptions](capi-udmf-oh-udmfoptions.md) instance.| 1994| [OH_UdmfData](capi-udmf-oh-udmfdata.md)** dataArray | Double pointer to the [OH_UdmfData](capi-udmf-oh-udmfdata.md) instance,<br>which should be released by using the [OH_Udmf_DestroyDataArray](capi-udmf-h.md#oh_udmf_destroydataarray) function.| 1995| unsigned int* dataSize | Pointer to the data size obtained.| 1996 1997**Returns** 1998 1999| Type| Description| 2000| -- | -- | 2001| int | Error code. For details, see [Udmf_ErrCode](capi-udmf-err-code-h.md#udmf_errcode).<br>Returns **UDMF_E_OK** if the operation is successful.<br>Returns **UDMF_E_INVALID_PARAM** if an invalid parameter is passed in.<br>Returns **UDMF_ERR** if an internal data error occurs.| 2002 2003### OH_Udmf_SetUnifiedData() 2004 2005``` 2006int OH_Udmf_SetUnifiedData(Udmf_Intention intention, OH_UdmfData* unifiedData, char* key, unsigned int keyLen) 2007``` 2008 2009**Description** 2010 2011Sets an [OH_UdmfData](capi-udmf-oh-udmfdata.md) instance in the UDMF database. 2012 2013**Since**: 12 2014 2015 2016**Parameters** 2017 2018| Name| Description| 2019| -- | -- | 2020| [Udmf_Intention](#udmf_intention) intention | Data channel type [Udmf_Intent](capi-udmf-h.md#udmf_intention).| 2021| [OH_UdmfData](capi-udmf-oh-udmfdata.md)* unifiedData | Pointer to the [OH_UdmfData](capi-udmf-oh-udmfdata.md) instance.| 2022| key | Pointer to the key that uniquely identifies the data in the database.| 2023| unsigned int keyLen | Length of the key. The memory size must be greater than or equal to 512 bytes.| 2024 2025**Returns** 2026 2027| Type| Description| 2028| -- | -- | 2029| int | Error code. For details, see [Udmf_ErrCode](capi-udmf-err-code-h.md#udmf_errcode).<br>Returns **UDMF_E_OK** if the operation is successful.<br>Returns **UDMF_E_INVALID_PARAM** if an invalid parameter is passed in.<br>Returns **UDMF_ERR** if an internal data error occurs.| 2030 2031### OH_Udmf_SetUnifiedDataByOptions() 2032 2033``` 2034int OH_Udmf_SetUnifiedDataByOptions(OH_UdmfOptions* options, OH_UdmfData *unifiedData, char *key, unsigned int keyLen) 2035``` 2036 2037**Description** 2038 2039Sets an [OH_UdmfData](capi-udmf-oh-udmfdata.md) instance in the UDMF database. 2040 2041**Since**: 20 2042 2043 2044**Parameters** 2045 2046| Name| Description| 2047| -- | -- | 2048| [OH_UdmfOptions](capi-udmf-oh-udmfoptions.md)* options | Pointer to the [OH_UdmfOptions](capi-udmf-oh-udmfoptions.md) instance.| 2049| [OH_UdmfData](capi-udmf-oh-udmfdata.md) *unifiedData | Pointer to the [OH_UdmfData](capi-udmf-oh-udmfdata.md) instance.| 2050| char *key | Pointer to the key that uniquely identifies the data in the database. The memory size must be greater than [UDMF_KEY_BUFFER_LEN](#udmf_key_buffer_len).| 2051| unsigned int keyLen | Length of the key.| 2052 2053**Returns** 2054 2055| Type| Description| 2056| -- | -- | 2057| int | Error code. For details, see [Udmf_ErrCode](capi-udmf-err-code-h.md#udmf_errcode).<br>Returns **UDMF_E_OK** if the operation is successful.<br>Returns **UDMF_E_INVALID_PARAM** if an invalid parameter is passed in.<br>Returns **UDMF_ERR** if an internal data error occurs.| 2058 2059### OH_Udmf_UpdateUnifiedData() 2060 2061``` 2062int OH_Udmf_UpdateUnifiedData(OH_UdmfOptions* options, OH_UdmfData* unifiedData) 2063``` 2064 2065**Description** 2066 2067Updates an [OH_UdmfData](capi-udmf-oh-udmfdata.md) instance in the UDMF database. 2068 2069**Since**: 20 2070 2071 2072**Parameters** 2073 2074| Name| Description| 2075| -- | -- | 2076| [OH_UdmfOptions](capi-udmf-oh-udmfoptions.md)* options | Pointer to the [OH_UdmfOptions](capi-udmf-oh-udmfoptions.md) instance.| 2077| [OH_UdmfData](capi-udmf-oh-udmfdata.md)* unifiedData | Pointer to the [OH_UdmfData](capi-udmf-oh-udmfdata.md) instance.| 2078 2079**Returns** 2080 2081| Type| Description| 2082| -- | -- | 2083| int | Error code. For details, see [Udmf_ErrCode](capi-udmf-err-code-h.md#udmf_errcode).<br>Returns **UDMF_E_OK** if the operation is successful.<br>Returns **UDMF_E_INVALID_PARAM** if an invalid parameter is passed in.<br>Returns **UDMF_ERR** if an internal data error occurs.| 2084 2085### OH_Udmf_DeleteUnifiedData() 2086 2087``` 2088int OH_Udmf_DeleteUnifiedData(OH_UdmfOptions* options, OH_UdmfData** dataArray, unsigned int* dataSize) 2089``` 2090 2091**Description** 2092 2093Deletes an [OH_UdmfData](capi-udmf-oh-udmfdata.md) instance from the UDMF database. 2094 2095**Since**: 20 2096 2097 2098**Parameters** 2099 2100| Name| Description| 2101| -- | -- | 2102| [OH_UdmfOptions](capi-udmf-oh-udmfoptions.md)* options | Pointer to the [OH_UdmfOptions](capi-udmf-oh-udmfoptions.md) instance.| 2103| [OH_UdmfData](capi-udmf-oh-udmfdata.md)** dataArray | Double pointer to the [OH_UdmfData](capi-udmf-oh-udmfdata.md) instance,<br>which should be released by using the [OH_Udmf_DestroyDataArray](capi-udmf-h.md#oh_udmf_destroydataarray) function.| 2104| unsigned int* dataSize | Pointer to the data size obtained.| 2105 2106**Returns** 2107 2108| Type| Description| 2109| -- | -- | 2110| int | Error code. For details, see [Udmf_ErrCode](capi-udmf-err-code-h.md#udmf_errcode).<br>Returns **UDMF_E_OK** if the operation is successful.<br>Returns **UDMF_E_INVALID_PARAM** if an invalid parameter is passed in.<br>Returns **UDMF_ERR** if an internal data error occurs.| 2111 2112### OH_Udmf_DestroyDataArray() 2113 2114``` 2115void OH_Udmf_DestroyDataArray(OH_UdmfData** dataArray, unsigned int dataSize) 2116``` 2117 2118**Description** 2119 2120Destroys the memory of the data array. 2121 2122**Since**: 20 2123 2124 2125**Parameters** 2126 2127| Name| Description| 2128| -- | -- | 2129| [OH_UdmfData](capi-udmf-oh-udmfdata.md)** dataArray | Double pointer to the [OH_UdmfData](capi-udmf-oh-udmfdata.md) instance.| 2130| unsigned int dataSize | Data size.| 2131 2132**See** 2133 2134OH_UdmfData 2135 2136### OH_UdmfProgressInfo_GetProgress() 2137 2138``` 2139int OH_UdmfProgressInfo_GetProgress(OH_Udmf_ProgressInfo* progressInfo) 2140``` 2141 2142**Description** 2143 2144Obtains the progress (in percentage) from an [OH_Udmf_ProgressInfo](capi-udmf-oh-udmf-progressinfo.md) instance. 2145 2146**Since**: 15 2147 2148 2149**Parameters** 2150 2151| Name| Description| 2152| -- | -- | 2153| [OH_Udmf_ProgressInfo](capi-udmf-oh-udmf-progressinfo.md)* progressInfo | Pointer to the [OH_Udmf_ProgressInfo](capi-udmf-oh-udmf-progressinfo.md) instance.| 2154 2155**Returns** 2156 2157| Type| Description| 2158| -- | -- | 2159| int | Progress obtained, in percentage.| 2160 2161### OH_UdmfProgressInfo_GetStatus() 2162 2163``` 2164int OH_UdmfProgressInfo_GetStatus(OH_Udmf_ProgressInfo* progressInfo) 2165``` 2166 2167**Description** 2168 2169Obtains the status information from an [OH_Udmf_ProgressInfo](capi-udmf-oh-udmf-progressinfo.md) instance. 2170 2171**Since**: 15 2172 2173 2174**Parameters** 2175 2176| Name| Description| 2177| -- | -- | 2178| [OH_Udmf_ProgressInfo](capi-udmf-oh-udmf-progressinfo.md)* progressInfo | Pointer to the [OH_Udmf_ProgressInfo](capi-udmf-oh-udmf-progressinfo.md) instance.| 2179 2180**Returns** 2181 2182| Type| Description| 2183| -- | -- | 2184| int | Status information obtained.| 2185 2186### OH_UdmfGetDataParams_Create() 2187 2188``` 2189OH_UdmfGetDataParams* OH_UdmfGetDataParams_Create() 2190``` 2191 2192**Description** 2193 2194Creates an [OH_UdmfGetDataParams](capi-udmf-oh-udmfgetdataparams.md) instance and a pointer to it.<br>If this pointer is no longer required, use [OH_UdmfGetDataParams_Destroy](capi-udmf-h.md#oh_udmfgetdataparams_destroy) to destroy it. Otherwise, memory leaks may occur. 2195 2196**Since**: 15 2197 2198**Returns** 2199 2200| Type| Description| 2201| -- | -- | 2202| [OH_UdmfGetDataParams](capi-udmf-oh-udmfgetdataparams.md)* | Returns a pointer to the [OH_UdmfGetDataParams](capi-udmf-oh-udmfgetdataparams.md) instance created if the operation is successful; returns **nullptr** otherwise.| 2203 2204### OH_UdmfGetDataParams_Destroy() 2205 2206``` 2207void OH_UdmfGetDataParams_Destroy(OH_UdmfGetDataParams* pThis) 2208``` 2209 2210**Description** 2211 2212Destroys an [OH_UdmfGetDataParams](capi-udmf-oh-udmfgetdataparams.md) instance. 2213 2214**Since**: 15 2215 2216 2217**Parameters** 2218 2219| Name| Description| 2220| -- | -- | 2221| [OH_UdmfGetDataParams](capi-udmf-oh-udmfgetdataparams.md)* pThis | Pointer to the [OH_UdmfGetDataParams](capi-udmf-oh-udmfgetdataparams.md) instance.| 2222 2223### OH_UdmfGetDataParams_SetDestUri() 2224 2225``` 2226void OH_UdmfGetDataParams_SetDestUri(OH_UdmfGetDataParams* params, const char* destUri) 2227``` 2228 2229**Description** 2230 2231Sets the destination directory in an [OH_UdmfGetDataParams](capi-udmf-oh-udmfgetdataparams.md) instance.<br>If the destination directory is set, data of the file type will be copied to the specified directory. The file type data obtained in the callback will be replaced with the URI of the destination directory.<br>If the destination directory is not specified, the file will not be copied. The file type data obtained in the callback is the URI of the source directory.<br>If the application involves complex file processing or files need to be copied to multiple directories, you are advised to leave this parameter unspecified and let the application handle the file copy. 2232 2233**Since**: 15 2234 2235 2236**Parameters** 2237 2238| Name| Description| 2239| -- | -- | 2240| [OH_UdmfGetDataParams](capi-udmf-oh-udmfgetdataparams.md)* params | Pointer to the [OH_UdmfGetDataParams](capi-udmf-oh-udmfgetdataparams.md) instance.| 2241| const char* destUri | Destination directory to set.| 2242 2243### OH_UdmfGetDataParams_SetFileConflictOptions() 2244 2245``` 2246void OH_UdmfGetDataParams_SetFileConflictOptions(OH_UdmfGetDataParams* params, const Udmf_FileConflictOptions options) 2247``` 2248 2249**Description** 2250 2251Sets the policy for resolving file conflicts in an [OH_UdmfGetDataParams](capi-udmf-oh-udmfgetdataparams.md) instance. 2252 2253**Since**: 15 2254 2255 2256**Parameters** 2257 2258| Name| Description| 2259| -- | -- | 2260| [OH_UdmfGetDataParams](capi-udmf-oh-udmfgetdataparams.md)* params | Pointer to the [OH_UdmfGetDataParams](capi-udmf-oh-udmfgetdataparams.md) instance.| 2261| const [Udmf_FileConflictOptions](#udmf_fileconflictoptions) options | Policy to set.| 2262 2263### OH_UdmfGetDataParams_SetProgressIndicator() 2264 2265``` 2266void OH_UdmfGetDataParams_SetProgressIndicator(OH_UdmfGetDataParams* params, const Udmf_ProgressIndicator progressIndicator) 2267``` 2268 2269**Description** 2270 2271Sets the progress indicator in an [OH_UdmfGetDataParams](capi-udmf-oh-udmfgetdataparams.md) instance. 2272 2273**Since**: 15 2274 2275 2276**Parameters** 2277 2278| Name| Description| 2279| -- | -- | 2280| [OH_UdmfGetDataParams](capi-udmf-oh-udmfgetdataparams.md)* params | Pointer to the [OH_UdmfGetDataParams](capi-udmf-oh-udmfgetdataparams.md) instance.| 2281| const [Udmf_ProgressIndicator](#udmf_progressindicator) progressIndicator | Whether to use the default progress indicator.| 2282 2283### OH_UdmfGetDataParams_SetDataProgressListener() 2284 2285``` 2286void OH_UdmfGetDataParams_SetDataProgressListener(OH_UdmfGetDataParams* params, const OH_Udmf_DataProgressListener dataProgressListener) 2287``` 2288 2289**Description** 2290 2291Sets the callback used to return the progress obtained in an [OH_UdmfGetDataParams](capi-udmf-oh-udmfgetdataparams.md) instance. 2292 2293**Since**: 15 2294 2295 2296**Parameters** 2297 2298| Name| Description| 2299| -- | -- | 2300| [OH_UdmfGetDataParams](capi-udmf-oh-udmfgetdataparams.md)* params | Pointer to the [OH_UdmfGetDataParams](capi-udmf-oh-udmfgetdataparams.md) instance.| 2301| const [OH_Udmf_DataProgressListener](#oh_udmf_dataprogresslistener) dataProgressListener | Callback to set.| 2302