Microsoft.WindowsAPICodePack-Shell by MicrosoftMicrosoft.WindowsAPICodePack-Core by Microsoft
然后通过下面的代码可以添加备注:
注意:不是所有的文件类型都可以加备注,有些文件类型是不可写的,我建议在循环中使用Try catch 语句来过滤掉不可写的。
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.WindowsAPICodePack.Shell;
using Microsoft.WindowsAPICodePack.Shell.PropertySystem;
namespace App1
{
class Program
{
static void Main(string[] args)
{
string filePath = @"D:\Tools\steps.docx";
var file = ShellFile.FromFilePath(filePath);
file.Properties.System.Comment.Value = "Test Comments";
}
}
}
Microsoft.WindowsAPICodePack-Shell by MicrosoftMicrosoft.WindowsAPICodePack-Core by Microsoft
然后通过下面的代码可以添加备注:
注意:不是所有的文件类型都可以加备注,有些文件类型是不可写的,我建议在循环中使用Try catch 语句来过滤掉不可写的。
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.WindowsAPICodePack.Shell;
using Microsoft.WindowsAPICodePack.Shell.PropertySystem;
namespace App1
{
class Program
{
static void Main(string[] args)
{
string filePath = @"D:\Tools\steps.docx";
var file = ShellFile.FromFilePath(filePath);
file.Properties.System.Comment.Value = "Test Comments";
}
}
}