Freigeben über


Connecting two Visio web parts

I’m taking a break from talking about forms and workflow to share a simple idea which I think is quite useful around Visio diagrams in SharePoint 2010. One of the new features in SharePoint 2010 is Visio services, which enables you to display Visio diagrams in the browser.

Below is a screenshot of a simple approval process diagram displayed within a SharePoint page. This is all well and good, but where things really get interesting is when you have diagrams connected. For example, this diagram is extremely simple. A real approval process probably involves considerably more stages. So each shape in this diagram actually relates to a subprocess.

I have the ability to link two Visio web parts together so that a second diagram shows the subprocess when a shape is selected in the first.

To do this, we need to go back to the diagram in Visio. Each shape in a Visio diagram can have data attached to it. This is referred to, unsurprisingly, as Shape Data. By default, in a process diagram there are fields such as Cost and Start Date. We want to add a new field. You can do this individually, but it’s quicker to select all the shapes. Right-click on any one of them and go down the menu to data, which opens out a sub-menu. Click on Define Shape Data.

This opens up a new window showing the data fields that already exist. Click on the New button at the bottom of this window and this adds a new piece of data to all the shapes. By default, this will be given the label Property and then a number. Delete this label and add a new one. I call this field Subprocess. Once you’ve done that, click OK. Then you need to add a value to each shape. Click on each shape in turn and you will be able to give a value in the Shape Data Window. If you can’t see the Shape Data Window, go to the Data tab and tick the appropriate check box to make it appear.

Enter a suitable value for each shape.

Now, you need to go to the Visio file you want displayed in the second web part. Visio files can be split into multiple pages. You will want to create a new page for each subprocess. It’s vital that the pages are given the same names as the values you entered in the subprocess field. This is what SharePoint will use to choose what to display.

Once you have finished drawing your diagrams, you will need to publish both your files to the SharePoint site. This is done by going to the file menu, clicking on Save & Send and choosing the Save to SharePoint option. It’s important to remember to save the file as a web drawing, otherwise SharePoint won’t be able to display it. Once you’ve saved, it’s time to go to the SharePoint site.

Edit the page that you want your diagrams to display on and choose to insert a Visio Web Access part from the Office Client Applications menu. Do this twice.

Open the tool pane for the first web part. In the Web Drawing URL field, you need to give the location of the first Visio diagram in SharePoint. Then, a few fields down, you are given the option to expose shape data. Enter the name you gave to the field which said which subprocess the shape related to. Then click OK.

Open the tool pane for the second Visio diagram and select the appropriate URL. This time, you don’t have to worry about exposing shape data, but it’s probably a good idea to uncheck the box for Show Page Navigation.

Now we need to connect the two together.

Click on the arrow in the top-right of the first diagram to get a menu. One of the items in the menu is Connections, which opens up a sub-menu. Select Send Shape Data To and then the name of your second Visio web part.

This opens up a new window in which to set which data to send. Select the field which defines the subprocess as the provider field, and the page name as the consumer field.

Now, when you select a shape in the first diagram, the appropriate page will display in the second to show the subprocess.

Comments

  • Anonymous
    January 01, 2003
    I am unable to get my 2 webparts to connect. I have a visio diagram wiht 10 pages to it. I basically want the first shape to open page 3 of my diagram in webpart 2. followed the steps you provided but it just shows the same info as webpart1.

  • Anonymous
    April 28, 2011
    I struck somewhere in the middle.. Will try again. Thanks Bijay www.fewlines4biju.com/.../query-list-by-using-caml-in-sharepoint.html