1

After adding metadata property handler for .svg extension with this tool, I am able to add keywords to .svg files via Windows Explorer.

FileMeta Association Manager

I am now searching a way to add keywords via a C# application. I found this solution but System.AccessViolationException is thrown with the code:

using Microsoft.WindowsAPICodePack.Shell;

var tags = new[] {"foo", "bar"};
var file = ShellFile.FromFilePath(path);
// following statement throws System.AccessViolationException
file.Properties.System.Keywords.Value = tags;

What can be the cause?


Edit:

This method works correctly but COMException is thrown if tag length is too high.

using DSOFile;

var file = new OleDocumentProperties();
file.Open(path);
file.SummaryProperties.Keywords = string.Join(";", tags);
file.Close(true);
alex
  • 5,441
  • 6
  • 31
  • 54
  • Since there are several, which [`WindowsAPICodePack` nuget package](https://www.nuget.org/packages?q=WindowsAPICodePack) did you install? (See [Windows API Code Pack: Where is it?](https://stackoverflow.com/q/24081665/150605)) Possibly related: [C# WindowsApiCodepack PropertySystem AccessViolationException](https://stackoverflow.com/q/28076941/150605) – Lance U. Matthews Jan 27 '20 at 22:00
  • I tried nuget packages [by Aybe](https://github.com/aybe/Windows-API-Code-Pack-1.1) and by [Microsoft](http://code.msdn.microsoft.com/WindowsAPICodePack) – alex Jan 27 '20 at 22:10
  • @alex Did you find a solution? – Ann L. Feb 05 '22 at 18:38
  • @AnnL. No, I am sorry. I abandoned this feature. – alex Feb 08 '22 at 17:45

0 Answers0