{Dynamics CRM + Outlook} Object does not support method or property “setSrc” in web resource control–Dynamics CRM outlook client

Recently my customer integrated their Dynamics CRM with outlook client. Everything was going fine until they reported that reported that when the CRM fields for Email entity are loading in Outlook client, they are getting the below error.



Ok. So first things first. Where and why is setSrc method is being used?

Well, my customer had a web resource on the email form and they were dynamically setting the URL of the webresource using the below code.

function FormLoad(){

var webResource = Xrm.Page.getControl(“<WebResourceName>”);

if(webResource != null){
webResource.setSrc(Xrm.Page.context.getClientUrl() + “<path to webresource>”);



The code seemed to work perfectly fine in Web Client. However in Outlook client it started throwing the above error.

So instead of setting the source of the Web Resource control, we decided to use the getObject method of the WebResource control. The getObject method returns the HTML IFrame element representing the webresource control.

And as many of you might be thinking whether it is supported to use this or not, the good news is, it is a documented method. So you can use it. And to my surprise, many were not aware of the same and was not sure whether it is supported or not.

And the last step would be to set the source of the IFrame element using its src attribute. To make the code more generic, the below code would work across your web as well as outlook clients.

var webResource = Xrm.Page.getControl(“<WebResourceName>”);

if (webResource != null) {
webResource.setSrc(Xrm.Page.context.getClientUrl() + “<path to web resource>”);

var iframeObject = webResource.getObject();
iframeObject.src = Xrm.Page.context.getClientUrl() + “<path to web resource>”;




Off course you can be more explicit in the catch for the specific errors but this is just a demo code and you can modify as per your needs.


Hope this helps.

Debajit Dutta

(Visit our products page – http://www.xrmforyou.com/products-1.html to know more about our offerings)

About Debajit
I am a Dynamics CRM Most Valuable Professional (MVP) with 12 years of experience in Microsoft .NET Technologies and 9 years of dedicated experience in Microsoft Dynamics CRM. I have worked with companies like Microsoft, SanDisk, PwC, TMF Group and have extensive experience of implementing complex CRM solutions from both offshore and client side. Currently the face of XrmForYou.com with significant experience in delivering corporate training on Dynamics CRM and have already delivered multiple projects to client through XrmForYou.com Author of multiple tools on codeplex including the 'Role Based Views' and 'CRM-Sharepoint Metadata manager & Attachment Extractor' which are available for commercial use under XrmForYou.com For consulting/ training, drop me a note at info@xrmforyou.com or visit our website www.xrmforyou.com

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: