'C# Word Interop cannot change "Creation Date" built in document property for some reason

Code I use:

string fullPath = null;
DateTime creationDate = new DateTime();
string creatorName = null;
foreach (var arg in args) {
    if (arg.Contains("--path")) {
        fullPath = arg.Substring(7);
    }
    if (arg.Contains("--creationDate")) {
        creationDate = DateTime.Parse(arg.Substring(15));
    }
    if (arg.Contains("--creatorName")) {
        creatorName = arg.Substring(14);
    }
}

var wordInterop = new Microsoft.Office.Interop.Word.Application();
var wordWorkBook = wordInterop.Documents.Open(fullPath);

wordWorkBook.BuiltInDocumentProperties["Creation Date"].Value = creationDate;
wordWorkBook.BuiltInDocumentProperties["Author"].Value = creatorName;
wordWorkBook.Save();
wordInterop.Quit();
Marshal.ReleaseComObject(wordWorkBook);
Marshal.ReleaseComObject(wordInterop);

File.SetCreationTime(fullPath, creationDate);

Whenever I print out the creation date, it stays the same. Setting the author property works.

I tried spoofing Excel with this method, it works.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source