FileManagerItemMetadata.GetValueByKey(String) Method
Returns the item’s metadata value with the specified key.
Namespace: DevExpress.Web
Assembly: DevExpress.Web.v24.2.dll
Declaration
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:
- the FileManagerItemMetadata.GetAllKeys and GetValueByKey methods (on the server side);
- the ASPxClientFileManagerItem.GetMetadata method (on the client side if the FileManagerSettings.EnableClientSideItemMetadata property is set to
true
).
...
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