4

I am trying to add or change file property. Like this question:

Get or set file details programmatically

but I am getting error. My OS is Windows 8.1. Isn't this code not working my OS.

My code:

ShellObject xml = ShellObject.FromParsingName(@"C:\Users\Muslum\Desktop\test.xml");
var writer = xml.Properties.GetPropertyWriter(); // throw exception in this line
//set value test 1
writer.WriteProperty(SystemProperties.System.Subject, "Test subject");

//set value test 2
//writer.WriteProperty("Test", "Value");
writer.Close();

Error Message:

An unhandled exception of type   'Microsoft.WindowsAPICodePack.Shell.PropertySystem.PropertySystemException' occurred in Microsoft.WindowsAPICodePack.Shell.dll

Additional information: Unable to get writable property store for this property.

Inner exception :

{"Error HRESULT E_FAIL has been returned from a call to a COM component."}

How can I resolve this problem?

Community
  • 1
  • 1
Müslüm ÖZTÜRK
  • 961
  • 1
  • 11
  • 30
  • 1
    Try it with a file format that is actually capable of storing metadata. Like a .jpeg file. Not .xml, that's a fail whale. – Hans Passant Mar 08 '14 at 09:30
  • I tried it with a jpg file but this time gave error next line. The error is "Additional information: Unable to set property.". Actually I need this in xml file. How can I do this in xml file? – Müslüm ÖZTÜRK Mar 08 '14 at 09:40
  • This is probably because the file type does not have this property. – Alvimar Jan 31 '18 at 17:05
  • Did you ever find the reason for this failure, Muslum? This error is so frustrating – user2619824 Mar 19 '19 at 23:27

0 Answers0