Enterprise deployment for Visio Templates using Content Types in SharePoint 2010

I recently finished an engagement with a customer who developed their own custom shapes and template to help enforce a corporate standard for all process diagrams authored by business owners within the organization.

Once the template and stencils were finished, the focus shifted to maintenance and deployment.  Visio is a client based application so most Visio based solutions are deployed to each individual client using technologies like ClickOnce or Windows Installed (MSI).  This is fine if your Visio solution contains an add-in that must be installed locally, but what if your solution is nothing more than a template and a stencil full of custom shapes?  You certainly do not need to create a complex MSI deployment project just to install a template and stencil to the users in your organization.

Why not just use a content type on your SharePoint site as the means for deploying your custom templates and stencils to your users?

As you make changes to your template and stencils you do not have to worry about deploying the updated files to each client.  Simply upload the updated files to your SharePoint site and users automatically get the latest and greatest when they create new diagrams or even editing existing diagrams.

If you are not familiar with Content Types in SharePoint then review this article, https://msdn.microsoft.com/en-us/library/ms472236.aspx.

NOTE: This article outlines the process for creating a content type in SharePoint 2010 which is compatible with Visio 2010 as well as Visio 2007. You can also create a content type in SharePoint 2007 however the steps are different. I also want to point out that Visio 2003 cannot create new diagrams from templates that are configured as content types from any version of SharePoint or WSS. For more information on this topic refer to this article, https://support.microsoft.com/kb/826412 .

Creating the content type

A content type is easily created using SharePoint Designer 2010.  If you do not have SharePoint Designer 2010 you can get it for free here, https://sharepoint.microsoft.com/en-us/product/related-technologies/pages/sharepoint-designer.aspx.

  1. Start SharePoint Designer 2010
  2. Navigate to the site where you would like to define the content type.
    Note: If you define the content type on the root site then it will be available to all subsites.
  3. In the Navigation pane, select Content Types and click on the New button in the ribbon.
  4. In the Create a Content Type form…
    1. enter a Name that will be used to identify the content type in the UI as well as a Description
    2. for the parent content type select Document from the Document Content Types group
    3. and to organize your content type choose a group or create a new group

image

Click on OK to close the Create a Content Type form and your new content type will be added to the list.

image

Next we want to upload our Visio template and stencils that will be used for this content type.

  1. Select the new content type by clicking on its name and you will open the content type for editing.
  2. Click on the Administration Web Page button in the ribbon.
    image
  3. In the Administration Web Page for the content type click on the Advanced Settings link.
    clip_image004
  4. On the Advanced Settings page select the option to upload a new document template
    image
  5. Click on OK and the selected Visio template will be uploaded to the content type.

The upload option that you selected only uploaded your Visio template to the content type in your SharePoint site, but what about your stencils.  In order to upload the stencils that go with this template we will need to dig a little deeper into the content type.

When the content type is created and a file is uploaded the uploaded file is stored in the _cts folder for the site.  In SharePoint Designer you can find this folder easily by clicking on the All Files item in the Navigation pane.

image

Open the _cts folder and you will notice a folder named for your new content type.

image

If you open this new folder you will see the template that you uploaded to the content type when you created it.  Now all you need to do is add the stencil(s) that relate to your template and you can do this by just dragging and dropping your stencil files into this folder, or the Import Files button on the ribbon.

image

This works because Visio looks for the stencils that were associated with the template in the same folder that the template was opened from.  Because the template and the stencils are all contained in the same content type folder they will open properly for all users of your site.

But we are still not done!  We need to associate this new content type with our document library so that users get the option to create a new document using our template right from our document library.

In SharePoint Designer click on the Lists and Libraries item in the Navigation pane and click on the document library that should use this content type

image

We are only interested in the Content Types for this document library which you will find in the lower left corner of the Edit pane.image

This happens to be prepopulated with other content types as I chose the Process Diagrams document library of a Visio Process Repository site template.

I chose to remove all those other content types before adding my content type using the Add button in the Content Types section.image

Now we are done and at this point we can navigate back to our document library in the browser and from the New button on the DOcuments tab we can see and select the template that we uploaded.

image

This also works from SharePoint Workspace for offline access to the content type as well.

image

One of the added benefits is when the users go to save their new diagrams Visio automatically redirects them to the document library on the SharePoint site where the content type was used.

image

Pushing out updates

I think the real gain using a content type for your templates and stencils comes when it is time to push out an update.  As you have seen the content type points to a folder on the SharePoint site so why not just upload the latest version of your template and stencils to this folder when they are updated?  That is exactly what you can do.

image

For example if you make some changes to the shapes in your stencils, you simply need to upload the new copies of the stencils to this folder and they will automatically be available to any new diagrams created from your template as well as any previous diagrams that are already saved in the document library.

Do notice however that I uploaded the updated files to both the _cts folder and all Forms folders for the document libraries using this content type.  SharePoint will not automatically replicate updated files from the _cts folder to the appropriate Forms folders for all the document libraries.

Disclaimer: This mechanism does not solve the age old problem of updating old shapes in a diagram. If you open a diagram that contains an old version of a shape that was recently updated you still need to remove the old shape from the diagram and replace it with the new version from the stencil.