Unable to update MS tag using Microsoft.WindowsAPICodePack.Shell.PropertySystem .tmp files are getting created
Hiras, Amit
1
Reputation point
I am using .net core 6 console app to write tags to Microsoft Files like Word/Excel, in some cases, the code is creating .tmp files and not updating the tag of the file, the code does not throw any exceptions as well.
Kindly suggest a way to write file tag programmatically or let me know what I need to correct in the below code.
using Microsoft.WindowsAPICodePack.Shell;
using Microsoft.WindowsAPICodePack.Shell.PropertySystem;
var shellFile = ShellFile.FromFilePath(filePath);
ShellPropertyWriter propertyWriter = shellFile.Properties.GetPropertyWriter();
propertyWriter.WriteProperty(SystemProperties.System.Keywords, tag);
propertyWriter.Close();
propertyWriter.Dispose();
Sign in to answer