In the previous post, I mentioned that the ESRI Map Web Part fully supports SharePoint hyperlink columns. This means that, if a list item has a hyperlink field, the value of that field will show up in the list item's pop-up. The Map Web Part even honors how the hyperlink field is formatted; if formatted as a hyperlink, the value shows up in the pop-up as a link. If formatted as an image, the value will instead show up as an image!
Want to try it out? Follow these steps:
- Create a new Contacts list
- Create a new item. Specify a name, address, and, in the Web Page field, a URL and description.
- Add the Web Page field to the list's default view.
- Add the list to a Map Web Part and geocode it.
- Hover over the geocoded point - you'll see the pop-up with the link you defined:

To add an image, simply add a new hyperlink field and specify that the URL be formatted as an image. Edit the list item, defining a URL for the image. Once you refresh the Map Web Part, the image will show up in the pop-up:

Large images are automatically resized to fit inside the web part, and clicking the image will open it in a new window. And, as you can see in the screenshot above, the image's description and URL are shown in a tooltip that appears when you mouse over the image.
Hyperlinks and Excel Integration
One advantage of being able to map SharePoint lists is that, thanks to SharePoint integration with Excel, this opens the door to mapping your Excel data. Of course, one great feature of Excel is formulas - the ability to calculate cell values based on other cells. Combine these with the Map Web Part's support for SharePoint hyperlink fields, and you have the ability to easily generate data-driven hyperlinks and images for an entire dataset that are available from within a map!
There is, however, one small caveat. Once a hyperlink column is synchronized between Excel and SharePoint, you can't use a formula to calculate the value of that column directly; the resulting values won't pass the synchronization add-in's data validation. But there's a simple workaround. All you need to do is calculate the values in a non-synchronized column and use a tiny bit of VBA to copy them over to the synchronized column.
To demonstrate this capability, I have created a spreadsheet that contains sample data and the VBA needed. Download the spreadsheet here. Starting with this spreadsheet, here's what you need to do:
- Publish the spreadsheet to SharePoint. For instructions on how to do this, refer to the documentation for the synchronization add-in.
- In SharePoint, add a hyperlink field to the list that was generated from the spreadsheet.
- In Excel, right-click the table and select Table > Synchronize with SharePoint. The hyperlink column will automatically appear in the spreadsheet.
- Copy the formula to calculate your hyperlinks into the column to the right of the hyperlink column (i.e. the first spreadsheet column outside the table). With the sample spreadsheet, you can use the formula below. The result is a Bing URL for each record that searches by city and state:
=CONCATENATE("http://www.bing.com/search?q=", TRIM(C2), "%2C", TRIM(B2))
- Open the VBA Editor (Developer > Visual Basic).
- In the code-behind for the workbook, notice the method below. If you are using your own data, copy this method into your workbook's code-behind.
Private Sub CopyHyperlinks(sourceColumn As String, targetColumn As String,
startRow As Integer, endRow As Integer)
Dim i As Integer
Dim sourceCell As String
Dim targetCell As String
For i = startRow To endRow
sourceCell = sourceColumn + CStr(i)
targetCell = targetColumn + CStr(i)
Call Worksheets(1).Hyperlinks.Add(Range(targetCell), _
Range(sourceCell).Value)
DoEvents
Next i
End SubThis method takes the letters of the columns to copy from and to, as well as the numbers of the rows to start and end the operation on. The values in the source cells are copied to the target cells as hyperlinks.
- Now look at the AddUrlsToTable method (above CopyHyperlinks):
Private Sub AddUrlsToTable()
Call CopyHyperlinks("V", "T", 2, 79)
'Call ConvertLinksToShortUrls("W", "U", 2, 79)
MsgBox "Operation Complete"
End Sub
This method simply calls CopyHyperlinks for the ranges of cells to copy hyperlinks from and to. If you are using your own data, copy this method and replace the parameters in the call to CopyHyperlinks with the letters and numbers of the columns and rows you want to copy.
- Run the AddUrlsToTable method by pressing the Play button.
- Once the operation is complete, right-click the table and select Table > Synchronize with SharePoint. The hyperlinks will be uploaded to the SharePoint list.
- Add the list to the Map Web Part and address match it. When you mouse over a feature, the Bing URL shows up in the pop-up as a clickable link:

Rich Zwaap
ESRI Product Engineer
ArcGIS Server .NET, Silverlight/WPF, MapIt