chris j.t. auld – director, intergen [email protected]@intergen.co.nz (@cauld)
TRANSCRIPT
![Page 1: Chris J.T. Auld – Director, Intergen Chris.auld@intergen.co.nzChris.auld@intergen.co.nz (@cauld)](https://reader035.vdocuments.site/reader035/viewer/2022062805/5697c0021a28abf838cc2e4d/html5/thumbnails/1.jpg)
Souping Up CRM 4 with Microsoft SilverlightChris J.T. Auld – Director, [email protected] (@cauld)www.syringe.net.nz
![Page 2: Chris J.T. Auld – Director, Intergen Chris.auld@intergen.co.nzChris.auld@intergen.co.nz (@cauld)](https://reader035.vdocuments.site/reader035/viewer/2022062805/5697c0021a28abf838cc2e4d/html5/thumbnails/2.jpg)
Notes Before We Start
AssumptionsSome prior CRM experienceNo prior Silverlight experienceLike demos where we build stuff
Learning GoalsPractical and Pragmatic techniquesCurrently shipping bits: CRM 4, SL3
Contact meChris Auld ([email protected])
![Page 3: Chris J.T. Auld – Director, Intergen Chris.auld@intergen.co.nzChris.auld@intergen.co.nz (@cauld)](https://reader035.vdocuments.site/reader035/viewer/2022062805/5697c0021a28abf838cc2e4d/html5/thumbnails/3.jpg)
AgendaOverviewWhat is Microsoft Silverlight? What is XAML?Where to use Silverlight?Tooling for Silverlight: Expression Blend and Visual StudioCalling into MSCRM from SilverlightHosting Silverlight inside the MSCRM UI
![Page 4: Chris J.T. Auld – Director, Intergen Chris.auld@intergen.co.nzChris.auld@intergen.co.nz (@cauld)](https://reader035.vdocuments.site/reader035/viewer/2022062805/5697c0021a28abf838cc2e4d/html5/thumbnails/4.jpg)
A TeaserA Quick Lap Around What We’ll Be Building Today
Demo #1
![Page 5: Chris J.T. Auld – Director, Intergen Chris.auld@intergen.co.nzChris.auld@intergen.co.nz (@cauld)](https://reader035.vdocuments.site/reader035/viewer/2022062805/5697c0021a28abf838cc2e4d/html5/thumbnails/5.jpg)
What is Microsoft Silverlight?A tool from Microsoft for building rich user interfaces that are browser hostedCross-browser (IE, Firefox, Safari)Cross-platform (PC, Mac, Linux*)Does NOT require the.NET Framework installed4 MB download, 4-10 seconds to installIncludes Core .NET FrameworkUse any .NET languages – VB, C#, JavaScript, IronPython, IronRubyRich presentation support – Animation, Inking, Video, Audio etc
*Community built Moonlight project offers Linux support
![Page 6: Chris J.T. Auld – Director, Intergen Chris.auld@intergen.co.nzChris.auld@intergen.co.nz (@cauld)](https://reader035.vdocuments.site/reader035/viewer/2022062805/5697c0021a28abf838cc2e4d/html5/thumbnails/6.jpg)
Why use Silverlight with MSCRM?Allows rich LoB UI via a Web Browser
Faster UI – Rich UI elements of rapid data I/O
Richer UI – Rich graphics for visualization of data
Allows Media unsupported by CRM UIE.g. No support for video or audio in out of box UI
Proprietary client side IPSilverlight binaries can be obfuscated
Local ‘Isolated Storage’ provides semi-offline experience
Use desktop development practices on the webCall WCF services, etc…
![Page 7: Chris J.T. Auld – Director, Intergen Chris.auld@intergen.co.nzChris.auld@intergen.co.nz (@cauld)](https://reader035.vdocuments.site/reader035/viewer/2022062805/5697c0021a28abf838cc2e4d/html5/thumbnails/7.jpg)
Silverlight vs WPFSilverlight implements a subset of WPFIt uses the same XAML notationDifferent hosting modelWPF is Microsoft Windows Only, Silverlight is Cross Platform
WPF Requires .NET Framework 3.0 or aboveKey things missing from Silverlight:
No hardware access (Webcams, Microphones, Etc…)Rich text features and flow documentsStyle features simplified – no inheritanceTriggers - not on styles, data or control templatesData binding more limited – no triggers, simplified Binding objectNo dynamic resource support
Still possible to write portable code for WPF + SilverlightSee for more details: http://tinyurl.com/cshosn
![Page 8: Chris J.T. Auld – Director, Intergen Chris.auld@intergen.co.nzChris.auld@intergen.co.nz (@cauld)](https://reader035.vdocuments.site/reader035/viewer/2022062805/5697c0021a28abf838cc2e4d/html5/thumbnails/8.jpg)
XAML: Declarative Programming for Windows
Markup for WindowsBuild applications in simple declarative statementsSerialization of an object tree
Code and content are separateStreamline collaboration between designers and developers
Easy for tools to consume and generate
<Button Width="100">OK <Button.Background> LightBlue </Button.Background></Button>
Button b1 = new Button();b1.Content = "OK";b1.Background = new SolidColorBrush (Colors.LightBlue);b1.Width = 100;
Dim b1 As New Buttonb1.Content = "OK"b1.Background = New _ SolidColorBrush _ (Colors.LightBlue)b1.Width = 100
OK
![Page 9: Chris J.T. Auld – Director, Intergen Chris.auld@intergen.co.nzChris.auld@intergen.co.nz (@cauld)](https://reader035.vdocuments.site/reader035/viewer/2022062805/5697c0021a28abf838cc2e4d/html5/thumbnails/9.jpg)
Hosting Silverlight ApplicationsSilverlight applications are hosted via a Web Browser plug-in using an HTML object tagCan specify HTML displayed if plug-in is missingSilverlight.js helper file allows creation via codeSilverlight uses the Hosts network stack and default credentialsCan use ASP.NET Server Control
<div id="silverlightControlHost"> <script type="text/javascript"> Silverlight.createObject( "ClientBin/SilverlightApplication1.xap", silverlightControlHost, // parent DHTML element "slPlugin", // id for generated object element {}, {}, "param1=value1,param2=value2", //Parameters "context”); </script></div>
![Page 10: Chris J.T. Auld – Director, Intergen Chris.auld@intergen.co.nzChris.auld@intergen.co.nz (@cauld)](https://reader035.vdocuments.site/reader035/viewer/2022062805/5697c0021a28abf838cc2e4d/html5/thumbnails/10.jpg)
Silverlight + MSCRM ScenariosUse Silverlight in a Web Portal
Build Silverlight applicationConnect Silverlight application to Microsoft CRM via a WCF ProxyHost Silverlight application in a new or existing web site
Use Silverlight inside the CRM UIBuild Silverlight applicationConnect Silverlight application to Microsoft CRMHost Silverlight application in an ASP.NET page in the ‘ISV’ folderSurface in the CRM UI
Use sitemap.xml to create a link to load it into the main paneUse ISV.config to launch new windowLoad into an iFrame on an entity form
![Page 11: Chris J.T. Auld – Director, Intergen Chris.auld@intergen.co.nzChris.auld@intergen.co.nz (@cauld)](https://reader035.vdocuments.site/reader035/viewer/2022062805/5697c0021a28abf838cc2e4d/html5/thumbnails/11.jpg)
Building out the Silverlight applicationDemo #2: Build It!
![Page 12: Chris J.T. Auld – Director, Intergen Chris.auld@intergen.co.nzChris.auld@intergen.co.nz (@cauld)](https://reader035.vdocuments.site/reader035/viewer/2022062805/5697c0021a28abf838cc2e4d/html5/thumbnails/12.jpg)
Connecting Silverlight to CRM Data• Use WCF and Add Service Reference• Connect via a WCF Proxy on the Server• Lightweight client proxy using HttpWebRequest
![Page 13: Chris J.T. Auld – Director, Intergen Chris.auld@intergen.co.nzChris.auld@intergen.co.nz (@cauld)](https://reader035.vdocuments.site/reader035/viewer/2022062805/5697c0021a28abf838cc2e4d/html5/thumbnails/13.jpg)
Connecting Silverlight to CRM Data• Use WCF and Add Service Reference
– Fast and familiar to CRM developers– Full access to data– Must use Dynamic Entities to work with data– Requires additional headers for CRM Authentication– Requires client to possess clear text credentials– See http://tinyurl.com/c5copm for helper code
Silverlight Applicatio
n
SOAP1.2
CRM Web Services
We’ll be taking this approach in the demo
![Page 14: Chris J.T. Auld – Director, Intergen Chris.auld@intergen.co.nzChris.auld@intergen.co.nz (@cauld)](https://reader035.vdocuments.site/reader035/viewer/2022062805/5697c0021a28abf838cc2e4d/html5/thumbnails/14.jpg)
Connecting Silverlight to CRM Data• Connect via a WCF Proxy on the Server
– Familiar to most .NET developers– Must write code for every type of data you need to access– Can ‘hide’ credentials on the server – suitable for public
web sites
Silverlight Applicatio
nWCF
CustomWCF
ServiceWCF
CRM Web Services
![Page 15: Chris J.T. Auld – Director, Intergen Chris.auld@intergen.co.nzChris.auld@intergen.co.nz (@cauld)](https://reader035.vdocuments.site/reader035/viewer/2022062805/5697c0021a28abf838cc2e4d/html5/thumbnails/15.jpg)
Connecting Silverlight to CRM Data• Lightweight client proxy using HttpWebRequest
– Smaller *.xap file loads faster– Full access to data– Requires client to possess clear text credentials– Requires purchase of the XRM Book to get library code– See http://www.thecrmbook.com
Silverlight Applicatio
nRAW SOAP CRM Web
Services
Help
er
![Page 16: Chris J.T. Auld – Director, Intergen Chris.auld@intergen.co.nzChris.auld@intergen.co.nz (@cauld)](https://reader035.vdocuments.site/reader035/viewer/2022062805/5697c0021a28abf838cc2e4d/html5/thumbnails/16.jpg)
Cross Domain Calls
www.contoso.comcrm.hosting.fabrikam.com
*.XAPWCF Call
GET ClientAccessPolicy.xml
WCF Call
![Page 17: Chris J.T. Auld – Director, Intergen Chris.auld@intergen.co.nzChris.auld@intergen.co.nz (@cauld)](https://reader035.vdocuments.site/reader035/viewer/2022062805/5697c0021a28abf838cc2e4d/html5/thumbnails/17.jpg)
Cross Domain Calls
Silverlight client calls a server’s serviceService is on different domain than that serving the *.xap fileSilverlight rejects callMust download a valid clientaccesspolicy.xml file
![Page 18: Chris J.T. Auld – Director, Intergen Chris.auld@intergen.co.nzChris.auld@intergen.co.nz (@cauld)](https://reader035.vdocuments.site/reader035/viewer/2022062805/5697c0021a28abf838cc2e4d/html5/thumbnails/18.jpg)
Cross Domain Policy Files
Silverlight looks for bothClientAccessPolicy.xml (Silverlight)CrossDomain.xml (Flash format)
File must be in the web roothttp://crm.contoso.com/clientaccesspolicy.xmlhttp://api.flickr.com/crossdomain.xml
![Page 19: Chris J.T. Auld – Director, Intergen Chris.auld@intergen.co.nzChris.auld@intergen.co.nz (@cauld)](https://reader035.vdocuments.site/reader035/viewer/2022062805/5697c0021a28abf838cc2e4d/html5/thumbnails/19.jpg)
Connecting the Silverlight app to CRMDemo #3: Wire It Up!
![Page 20: Chris J.T. Auld – Director, Intergen Chris.auld@intergen.co.nzChris.auld@intergen.co.nz (@cauld)](https://reader035.vdocuments.site/reader035/viewer/2022062805/5697c0021a28abf838cc2e4d/html5/thumbnails/20.jpg)
Working with XAML in Expression BlendDemo #4: Refine UI
![Page 21: Chris J.T. Auld – Director, Intergen Chris.auld@intergen.co.nzChris.auld@intergen.co.nz (@cauld)](https://reader035.vdocuments.site/reader035/viewer/2022062805/5697c0021a28abf838cc2e4d/html5/thumbnails/21.jpg)
Hosting Silverlight in CRM UI• Linked from Main Navigation using SiteMap.xml• Opened in a new window using ISV.config• Hosted in an iFrame on an entity form
![Page 22: Chris J.T. Auld – Director, Intergen Chris.auld@intergen.co.nzChris.auld@intergen.co.nz (@cauld)](https://reader035.vdocuments.site/reader035/viewer/2022062805/5697c0021a28abf838cc2e4d/html5/thumbnails/22.jpg)
Hosting– Link from Main Nav• Linked from Main Navigation using SiteMap.xml
– Suitable for Dashboards and applications that do not relate to a particular entity. Elements that should appear to be ‘part of CRM’
– Use ‘Dynamics CRM Demonstration Tools’ to edit SiteMap.xml– See http://tinyurl.com/4drvz2 by @ceibner for a good How-To
Link displayed here
HTML Page and hosted Silverlight application
displayed here
![Page 23: Chris J.T. Auld – Director, Intergen Chris.auld@intergen.co.nzChris.auld@intergen.co.nz (@cauld)](https://reader035.vdocuments.site/reader035/viewer/2022062805/5697c0021a28abf838cc2e4d/html5/thumbnails/23.jpg)
Hosting – Open new Window• Linked from Main Navigation using SiteMap.xml
– Suitable for Applications that should appear to be separate to CRM– Edit ISV.config –use code to merge with existing config data– See http://tinyurl.com/4drvz2 for a good How-To
Link displayed here
![Page 24: Chris J.T. Auld – Director, Intergen Chris.auld@intergen.co.nzChris.auld@intergen.co.nz (@cauld)](https://reader035.vdocuments.site/reader035/viewer/2022062805/5697c0021a28abf838cc2e4d/html5/thumbnails/24.jpg)
Hosting – IFrame in Entity Form• Hosted in a specific entity form
– Suitable for Applications that require their context of a given entity e.g. for a given Contact or Account
– Use CRM Customization to create an iFrame on the Entity Form– This is what we’ll be doing in the demo
iFrame hosts HTML PageHTML Page hosts Silverlight Control
![Page 25: Chris J.T. Auld – Director, Intergen Chris.auld@intergen.co.nzChris.auld@intergen.co.nz (@cauld)](https://reader035.vdocuments.site/reader035/viewer/2022062805/5697c0021a28abf838cc2e4d/html5/thumbnails/25.jpg)
Passing Context to SilverlightSilverlight supports initialization parameters passed in as a stringWhen using iFrame hosting need to pass through parameters
<div id="silverlightControlHost"> <script type="text/javascript"> Silverlight.createObject( "ClientBin/SilverlightApplication1.xap", silverlightControlHost, // parent DHTML element "slPlugin", // id for generated object element {}, {}, "param1=value1,param2=value2", //Parameters "context”); </script></div>
![Page 26: Chris J.T. Auld – Director, Intergen Chris.auld@intergen.co.nzChris.auld@intergen.co.nz (@cauld)](https://reader035.vdocuments.site/reader035/viewer/2022062805/5697c0021a28abf838cc2e4d/html5/thumbnails/26.jpg)
Passing iFrame ParametersConfigure iFrame to pass parameters
IFrame will pass through parameters for type, typename and id when loading the hosted page
http://yoursite/SLHost.aspx?type=1&typename=account&id={GUID}
![Page 27: Chris J.T. Auld – Director, Intergen Chris.auld@intergen.co.nzChris.auld@intergen.co.nz (@cauld)](https://reader035.vdocuments.site/reader035/viewer/2022062805/5697c0021a28abf838cc2e4d/html5/thumbnails/27.jpg)
Pass Parameters to SilverlightNeed to take URL with parameters and pass these into Silverlighthttp://yoursite/SLHost.aspx?type=1&typename=account&id={GUID}
<asp:Silverlight ID="Xaml1" runat="server" Source="~/ISV/ClientBin/myExample.xap" MinimumVersion="2.0.30523" ></asp:Silverlight>
public partial class _Default : System.Web.UI.Page{
protected void Page_Load(object sender, EventArgs e){ Xaml1.InitParameters += ",id=" + Request["id"];}
}
public partial class App : Application{
public App(){
this.Startup += this.Application_Startup;}private void Application_Startup(object sender, StartupEventArgs e){this.RootVisual = new Page();string id = e.InitParams["id"];
![Page 28: Chris J.T. Auld – Director, Intergen Chris.auld@intergen.co.nzChris.auld@intergen.co.nz (@cauld)](https://reader035.vdocuments.site/reader035/viewer/2022062805/5697c0021a28abf838cc2e4d/html5/thumbnails/28.jpg)
Hosting Silverlight in an iFrame with Context
Demo #5: Host it!
![Page 29: Chris J.T. Auld – Director, Intergen Chris.auld@intergen.co.nzChris.auld@intergen.co.nz (@cauld)](https://reader035.vdocuments.site/reader035/viewer/2022062805/5697c0021a28abf838cc2e4d/html5/thumbnails/29.jpg)
SummaryWhat is Microsoft Silverlight?Where to use Silverlight?Intro to XAMLCalling into MSCRM from SilverlightHosting Silverlight inside the MSCRM UI
Code on my blog later todayhttp://www.syringe.net.nz
![Page 30: Chris J.T. Auld – Director, Intergen Chris.auld@intergen.co.nzChris.auld@intergen.co.nz (@cauld)](https://reader035.vdocuments.site/reader035/viewer/2022062805/5697c0021a28abf838cc2e4d/html5/thumbnails/30.jpg)
© 2008 Microsoft Corporation. All rights reserved.This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.