Create a Link to Map an Address
Ever wanted to create a link in a SharePoint contact list or InfoPath form to click to view a map of a certain address? This technique is so simple, it will blow your mind! There are other ways, which entail embedding images, using REST web services and other custom code, but this one simply opens that address in the browser in a Bing map.
This can be done in SharePoint 2007, 2010, and in Office 365.
I’ll show you two ways to go about it. In both of these cases, I’ll assume you already have created fields for Street Address, City, State, and Zip code.
In InfoPath, here are the basics:
- Create a new field, and call it Map.
- Double click the name of the Map field to open its properties.
- Next to the Default value box, click the function button.
- Create a concatenation formula. We’re going to string together (concatenate) all of the address fields, into a specific URL.
concat(“http://www.bing.com/maps/?q=”, (LocationAddress, “%2C%20”, LocationCity, “%2C%20”, LocationState, “%20%20”, LocationZip, “&FORM=Z9FD”)
- Click OK.
- The default value will now look something like this, and be sure to leave the box checked so that the formula will always be refreshed.
- Click OK.
- Insert a cute little image into your form, something that looks like a map or globe or something.
- Click to select that image, and then on the Insert tab, choose Hyperlink.
- Click to select a Data Source for the Link To, and choose that Map field that you created earlier. Click OK.
- Done! Publish the form, and when you open the form and click the little map button, the browser will open to the Bing map of that location.
In SharePoint Designer, a form
- In SharePoint Designer, click the name of your list or library. In this example, it’s the out of box contacts list. In the Forms section on the right, click New, and create a new display form.
- Call it CustomDisplay, and set it as the default form.
(For the SharePoint 2007 method, Customize Form Pages in SharePoint (Video))
- Open this new form, and put the cursor in the Notes field, which is the last row of the table. Click the TAB key so that a new row is created at the end.
- Type “Map It” in the left cell, and in the right cell, insert that same graphic of something mappy.
- Click to select the image that you just inserted. It doesn’t have to be an image, you can just put a regular hyperlink in here. On the Insert tab in the ribbon, click Hyperlink.
- Paste the URL in the address box, and click OK:
- Save the page, and close SharePoint Designer. Open your contacts list in the browser, and open one of the contacts that has a real address in it. Click the icon you created, which will open the map!