Specifying SharePoint document properties via code?

Started by Nikolay, September 02, 2013, 04:37:00 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Nikolay

You can save Visio diagrams in a SharePoint library:


The SharePoint library may have additional fields defined (in the case above, it's "Property1" and "Property2")

You can set these for a Visio document (stored in that library) on the backstage:


This brings up a dialog where you can enter values for these properties:


The question is, how do I specify these properties programmatically (by code)?
For the built-in properties like "Title" for example, I can set a Document.Title, and the "Title" field in the SharePoint library will be set accordingly.

So how do I set custom fields?

I have tried to set these fields directly as well (by SharePoint Client Object Model and even by hand) but I cannot set them while the document is opened in Visio :(
The SharePoint built-in lock prevents editing document attributes while file is being held open in office application (Visio) - "office document lock".
Generally, I would like to just fill these fields in the document programmatically, and then save the document to SharePoint.

Thank you in advance!