Visio Guy

Visio Discussions => Visio Online, Cloud & SharePoint Issues => Topic started by: Nikolay on September 02, 2013, 04:37:00 PM

Title: Specifying SharePoint document properties via code?
Post by: Nikolay on September 02, 2013, 04:37:00 PM
You can save Visio diagrams in a SharePoint library:
(http://pix.academ.org/img/2013/09/02/b472eafc07ac3c1c13bc1a277965581d.png)

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:
(http://pix.academ.org/img/2013/09/02/3caa632dd5b0aa349200e6f9589020b9.png)

This brings up a dialog where you can enter values for these properties:
(http://pix.academ.org/img/2013/09/02/e7bea7280aea4ae9ac9eb4c6e68c0dff.png)

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!