Wednesday, June 23, 2010

Question for readers

I want to hear from you, leave a comment answering this question:

How do you envision GIS being used with SharePoint?

Thanks

Thursday, June 10, 2010

Spatial Web Parts with Silverlight in SharePoint 2010

In SharePoint 2010 (SP2010) you can create a silverlight web part pretty easy by just creating a custom control, then deploy the XAP file to the clientbin folder.  I should note that the pre-canned silverlight web part that I am using does not allow for DCOM bridges to be used, so to communicate between multiple silverlight web parts you would have to the Messaging API, which is quite easy, but that's for another day.

Getting Started, Open Visual Studios 2010, and create an empty SharePoint Project and a Silverlight Application.  For the Silverlight Application project ensure that the "Host the Silverlight Application in the new Web Site" is unchecked.

Now we are cooking with fire, and we can create our Silverlight application.  For this example, I will just add a map and one layer to the project. 
The next step is to place the XAP file in a location that can be used by SharePoint.  Right click on the Silverlight Application we just created and select Properties.  Click on the build tab and change the output path to: "..\..\..\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\LAYOUTS\ClientBin\".  Remove the quotes when you put this into the Output Path.

Save and compile the project.  If you get any errors, it's most likely you need to reference the proper ESRI silverlight libaries.
The next step is to configure the SharePoint Project. Add a new item to the SharePoint project and select Module. Double click on the Elements.xml file.

Configure the elements file to match the above image, you need to change the path of the Url to "_layouts/clientsbin/ XAPFILENAME.XAP" and change the Path from the textfile name to the XAP file name.

Click on the module and select the Project Output Refer -> Add a member -> Choose the Silverlight Application name -> in the Deployment Type Select ElementFile -> press OK
Select Build From main toolbar -> Configuration Manager -> Uncheck all the builds except for the SharePoint Project Name and make sure the SharePoint Project has deploy checked.

Save the Project and deploy to SharePoint. 

Open your SharePoint site -> Edit Page -> Add Silverlight Web Part -> enter in the text box the following "_layouts/clientbin/XAPFILENAME.XAP".  You should now see your web part.