写入文件元数据Windows应用商店应用

时间:2014-07-04 10:23:24

标签: windows-runtime windows-store-apps metadata

我有以下代码:

var props = App.CurrentFile.Properties.GetDocumentPropertiesAsync();
        props.GetResults().Comment = "Comments goes here";
        await props.GetResults().SavePropertiesAsync();

CurrentFile的类型为StorageFile。当我尝试使用SavePropertiesAsync()保存更新的注释值时,它会因以下COM异常而失败。

Error HRESULT E_FAIL has been returned from a call to a COM component.

我在这个博客上关注了一个非常基本的例子:

http://lunarfrog.com/blog/2011/10/17/winrt-wps-part1-storing-retrieving-metadata/

有什么想法吗?

谢谢, 杰

1 个答案:

答案 0 :(得分:2)

文件格式必须支持元数据。例如,XML文件不能具有任何属性,但JPEG文件可以。