locked
How to remove properties and personal information from a file (programmatically) RRS feed

  • Question

  • Hi everyone.

    When you click with right button in some file, and choose "properties", you can see the personal information of the creator in details tabs, like the screen below:

    001

    All kind of files has different type of properties: .mp3, .cdr, .doc, .tiff, etc...

    But if you click in "Remove Properties and Personal Information" in this same screen, you will see this:

    002

    How you see, Windows allow to you remove everything, just selecting all and clicking in "OK".

    What I ask is: how I do this same thing in C#? The default .NET framework don´t give access to this kind of action. This is a SO action, right?

    I tryed to use the "shelld32.dll" to do it, but it just allow to read the info, not setting.
    The Attributes Files info don´t work too.

    Anyone know what SO DLL I can use to do the same action tha SO do?

    Ty!

    Friday, June 12, 2015 12:34 PM

Answers

  • Hello Raphael,

    >>What I ask is: how I do this same thing in C#? The default .NET framework don´t give access to this kind of action. This is a SO action, right?

    Yes, it is, and for what you want, you might try:

    1. Since the default behavior of attributes for file types are stored in Subkeys  KEY_CLASSES_ROOT\SystemFileAssociations, you could try to modify the Subkeys in C#,
    2. Implement a property handler and using the IPropertyStore::SetValue method to Sets a new property value, or replaces or removes an existing value: https://msdn.microsoft.com/en-us/library/bb761475.aspx

    By the way, this issue is a windows desktop related issue, the current forum is used to discuss and ask questions about issues regarding the very core of .NET, including security, performance, hosting, base classes, interop, reliability, debugging, GC, and profiling.

    Regards.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Monday, June 15, 2015 3:19 AM