Change and create documentProperties

Aug 6, 2013 at 9:18 AM
Hi there,
I try to build a solution in C# that change and create BuiltInDocumentProperties and CustomDocumentProperties of Word Documents (doc and docx). I test with NetOffice but my changes will not save in the Document. Can anybody help to solve my problem?

I test it like this:
  app = new Word.Application();
  Word.Document doc = app.Documents.Open(@"test.doc");
  ((NetOffice.OfficeApi.DocumentProperties)doc.CustomDocumentProperties)["Test"].Value = DateTime.Now.ToLongTimeString();
  ((NetOffice.OfficeApi.DocumentProperties)doc.CustomDocumentProperties).Add("NewProp", false, NetOffice.OfficeApi.Enums.MsoDocProperties.msoPropertyTypeString, DateTime.Now.ToLongTimeString());

catch { }
Aug 6, 2013 at 1:26 PM
this post facing the same problem

When you add/change custom properties seems that the document is no changed,
so the WordApplication.ActiveDocument.Saved is still true.
Set it to false and then call the Save method of the Document, it will work!!

Aug 7, 2013 at 11:58 AM
Thx a lot, that solve this problem.
This works for local and network files, now I try to save files from Sharepoint (WSS 3.0 o_O) that didn´t works cause of other reasons. Does anybody know spontaneous a simple solution for the Sharepoint problem?
I start a google search by the way :)