Skip to main content
Tab

FileManagerItemMetadata.GetValueByKey(String) Method

Returns the item’s metadata value with the specified key.

Namespace: DevExpress.Web

Assembly: DevExpress.Web.v24.1.dll

NuGet Package: DevExpress.Web

Declaration

public object GetValueByKey(
    string key
)

Parameters

Name Type Description
key String

A string value that is the key.

Returns

Type Description
Object

An object which represents the item’s metadata value for the specified key property.

Remarks

An item’s metadata are key-value pairs of string and object types, respectively. The item’s metadata can be specified using the FileManagerItemProperties.Metadata property and an appropriate FileManagerFile or FileManagerFolder constructor. To access the item’s metadata, use the FileManagerItem.Metadata property.

To obtain the item’s metadata, use the following methods:

...
public string GetId(FileManagerFile file) {
    var id = (int)file.Metadata.GetValueByKey("numberKey");
    return id.ToString();
}
public string GetGuid(FileManagerFile file) {
    var guid = (Guid)file.Metadata.GetValueByKey("guidKey");
    return guid.ToString(); 
}
public string GetCreationDate(FileManagerFile file) {
    var date = (DateTime)file.Metadata.GetValueByKey("dateKey");
    return date.ToShortDateString() + " " + date.ToShortTimeString(); 
}
...
See Also