将注释[元数据]添加到文件

RC1*_*140 4 c# windows winforms

我很确定这可能只是不确定它的用语是什么以及如何做到这一点.基本上,如果您右键单击任何文件并转到属性然后摘要,则可以向文件添加注释等.

我想知道的是你如何从c#中解决这个问题.此外,一旦添加了注释,您如何在后一时间从文件中读取这些注释.

我确信它与文件的元数据有关,只是不知道去哪里看.我还需要在Windows窗体中执行此操作,因此权限不是那么大的问题.

提前致谢.

Mik*_*ger 6

使用DSO的示例,其中显示了如何设置作者和注释字段:

try
{
    DSOFile.OleDocumentPropertiesClass doc = new DSOFile.OleDocumentPropertiesClass();
    doc.Open(filename, false, DSOFile.dsoFileOpenOptions.dsoOptionDefault);

    doc.SummaryProperties.Author = author;
    doc.SummaryProperties.Comments = comments;

    doc.Close(true);
}
catch (Exception ex)
{
    throw new Exception("Could not update the file properties: " + filename, ex);
}
Run Code Online (Sandbox Code Playgroud)