Thursday, October 20, 2011

Reading SharePoint Form Data from Silverlight application (Via Mohamed M Malek)

Extracted from the original artical

I was trying to create a bing map silverlight application to be hosted on a custom SharePoint form page. This form is displaying the properties of a specific content type and within this content type I have two fields one for Latitude and one for Longitude. The requirement is actually to app to this form a Silverlight bing map that would display the location of this item. Also the solution should does not require any farm solutions as this is a sandbox environment.

I tried first to pass the initialization parameters to the silverlight application through the out of the box silverlight web part "Custom Initiation Parameters" but the thing is that these parameters are constant values and I even tried to get form values using scripts on this string but the string just got HTML encoded and passed as is to the silverlight application.

The option I had working is to use JScript from the silverlight application to read the form parameters. To do this I first created a hidden calculated column by display=none and not the column itself being hidden from the server side. and in that column I concatenated both values in one comma separated string as so

=CONCATSTRING([Latitude],",",[Longitude])

Then I changed the silverlight main application class to be somethig like this

For complete post click here

No comments:

Post a Comment