Get or set file details programmatically [duplicate]

萝らか妹 提交于 2019-12-14 03:43:58

问题


Try going to any file, right clicking on it, and clicking on the "Details" tab. Like this photo

I want to change this values. Also Can I add custom properties the file details. Especially I want to do this changes for tif,jpeg,png,pdf files. Can I see my custom properties in "Details" window?

I found this page but it can change only office files. http://www.microsoft.com/en-us/download/details.aspx?id=8422


回答1:


You can use the Windows API Code Pack. It has wrappers for the Windows Property System.




回答2:


Just an addition to Eli Arbels answer, an example from the documentation from the Windows API Code Pack (which works very well for us):

IShellProperty prop = ShellObject.FromParsingName(fileName).Properties.GetProperty(propertyName);

if (prop.ValueType == typeof(string))
{
    (prop as ShellProperty<string>).Value = value;
}


来源:https://stackoverflow.com/questions/21982898/get-or-set-file-details-programmatically

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!