How to call a silverlight xap file from server object model in sharepoint
How to call a silverlight xap file from server object model in sharepoint
We can call the silverlight xap file from server object model using sand box solution in sharepoint
Step-1
Open visuvalstudio->new->click sharepoint(left side)->empty Sharepoint Poject->(give project name)->Deploy as a sand box solution-finish
Step-2
In solution explorer->(Right click your project)->Add->New itme->Visual Web Part(Sandboxed)->(give name,eg-SandBoxExample)->(click add)
Step-3
Add the follwing code on your sand box webpart design page(SandBoxExample.ascx)
<object id="speedsilverlight"
data="data:application/x-silverlight-2," style="z-index:0" type="application/x-silverlight-2" width="320" height="270">
<param name="source" value="http://sample.com/samplexap/sample.xap"/>
<param name="windowless" value="true"/>
<param name="background" value="white" />
<param name="minRuntimeVersion" value="4.0.50401.0" />
<param name="autoUpgrade" value="true" />
<a href="http://go.microsoft.com/fwlink/?LinkID=149156&v=4.0.50401.0" style="text-decoration:none">
<img src="http://go.microsoft.com/fwlink/?LinkId=161376" alt="Get Microsoft Silverlight" style="border-style:none"/>
</a>
</object>
Step-4
Right click on your xap->copy shortcut-(Paste this shortcut on the second line of the code,Shown in image)
Step-5
Build you project->Pakage your Project(It was available in Build Menu)
Step-6
Open Your project Folder->Bin->Debug->(Copy the .wsp file)
In sharepoint site:
Open your site->site actions->site settings->Gallery->Soutions->(there upload your wsp file &Activate it)
Thats it,you can find this webpart in your custom weparts.You can insert the webpart,And this will call your silverlight webpart.
Comments
Post a Comment