Disable Scrollbar in Page Viewer WebPart

Use a Content Editor WebPart instead with the following HTML:

<iframe name="Iframe" src="yourURL" scrolling="no"
FRAMEBORDER="0" style="width:100%; border:0;  height:100%; overflow:hidden;">

1. Add a Content Editor WebPart to the Page
2. Click “Edit WebPart”
3. In Ribbon Tab “Format Text” click “Edit Source”
4. Copy and paste the code above into the “Edit Source”-window and replace “yourURL” with the URL you want to be displayed in the WebPart. Set the size of the WebPart to your needs.

Impersonation of Service Executions in Plug-Ins and Workflows

A service execution can be impersonated by instantiating a ServiceProxy an setting the CallerId.
The Plug-In (and maybe Workflow) has to be registered as full trust (IsolationMode=”None”) to use the DefaultNetworkCredentials, otherwise they will be null. Set the isolationmode in registerfile.
If you use Early Binding, don’t forget to enable proxy types by calling serviceProxy.EnableProxyTypes().

protected void ExecutePreAccountUpdate(LocalPluginContext localContext)
    if (localContext == null)
        throw new ArgumentNullException("localContext");

    IPluginExecutionContext context = localContext.PluginExecutionContext;

    var clientCredentials = new ClientCredentials();
    // Using custom credentials
    credentials.Windows.ClientCredential = new NetworkCredential(, , );

    // Using Default Credentials
    // credentials.Windows.ClientCredential = CredentialCache.DefaultNetworkCredentials;

    var orgUrl = "http:///XRMServices/2011/Organization.svc";
    var organizationServiceUri = new Uri(orgUrl);

    // To use SSL
    if (!string.IsNullOrEmpty(orgUrl) && orgUrl.Contains("https")) {
	ServicePointManager.ServerCertificateValidationCallback = delegate(object s, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors) { return true; };

    using (var serviceProxy = new OrganizationServiceProxy(organizationServiceUri, null, clientCredentials, null))
        serviceProxy.CallerId = new Guid("AAB4EBA7-BDD1-E211-A6C5-00155D0B2738");    //Impersonating serviceProxy

        var newTask = new Task();
        newTask.Description = "ServiceProxy created Task";
        newTask.Subject = "ServiceProxy created";

        var newTaskGuid = serviceProxy.Create(newTask);

Blog post about the different userIds, when impersonating Plug-Ins, Dialogs and Workflows: https://community.dynamics.com/crm/b/develop1/archive/2013/08/09/user-impersonation-in-plugins-workflow-and-dialogs.aspx

Debugging JavaScript that executes on Ribbon Button clicks

When you click a button in the ribbon, dynamics uses ajax to load the file where the js function is in (only once). Therefore you cannot set a breakpoint on the function, before the button click. Here I will present some solutions to debug such functions anyways:

  1. Set incorrect library in Ribbon definition
  2. Use “debugger;” statement
  3. Throw an error
  4. Use sourceUrl property

Set incorrect library in Ribbon definition

Interestingly dynamics loads the file where the function for the ribbon is in at page load. So the file is there, but won’t be used. By putting an incorrect library in the ribbon definition the ajax call will result in an 401 error. Luckily the function from the already loaded file will be used.
In this solution you can set a breakpoint before clicking on the button. Unfortunately this will also result in an error screen by dynamics.
Works in FF, Chrome. Not tested in IE.

Use “debugger;” statement

When you put


into your sourcecode the debugger will pause on this line.
Works in Chrome. Not tested in IE.

Throw an error

You can also throw an catch an error in your code:

            throw new Error('breakpoint');   //debugger will break here
        catch (e)

Then set your debugger to pause on all errors.
Works in Chrome, but not in FF. Not tested in IE.

Use sourceUrl property

By putting a

//@ sourceURL=filename.js

property into your javascript file, it will be listet as file in Chrome debugger, after it has been loaded. As it will be listet after you have clicked the button, you can only set a breakpoint after execution of the js function.
Works in Chrome, but not in FF. Not tested in IE.

Get Public Key Token for Assembly in Visual Studio

In Visual Studio Click Tools > External Tools > Add and enter the following:


Command: C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\sn.exe
Arguments: -T $(TargetPath)

Note: The path for the command can be different depending on you Visual Studio version. Just check in your file directory where the sn.exe is (might be v6.0A instead of v7.0A).

Error occurred in deployment step ‘Install app for SharePoint’: The provided App differs from another App with the same version and product ID

Cannot deploy a solution and getting the error: Error occurred in deployment step ‘Install app for SharePoint’: The provided App differs from another App with the same version and product ID.

Open the AppManifest.xml in code view and generate a new guid for the app -> Change value of ProductID.

Add URLs to Hyperlinks-List via XML or C#

ListInstance Elements.xml

         <Field Name=”URL”>www.google.de, Google</Field>


  • Webrelative URLs are not working here, only full or serverrelativ URLs are possible!
  • Don’t forget the space after the comma
  • C# – via Feature EventReceiver

    using (SPWeb web = properties.Feature.Parent as SPWeb)
    SPList list = web.Lists["Links"];
    SPListItem newItem = list.Items.Add();
    string name = “Google”;
    string url = “www.google.de”
    newItem["URL"] = url + “, ” + name;


  • All types of URLs are possible, for example you can set up the URL using web.ServerRelativeUrl.
  • Getting E-Mail and Attachments in Plug-In using LINQ

    When updating an e-mail entity, only updated metadata is available in InputParameters.
    Here is some code to get the whole entity and attachments using LINQ:

    protected void ExecutePostEMailUpdate(LocalPluginContext localContext)
        if (localContext == null)
    		throw new ArgumentNullException("localContext");
    	IPluginExecutionContext context = localContext.PluginExecutionContext;
    	IOrganizationService service = localContext.OrganizationService;
    	ITracingService tracingService = localContext.TracingService;
    	OrganizationServiceContext serviceContext = new OrganizationServiceContext(service);
    	if (context.InputParameters.Contains("Target") && context.InputParameters["Target"] is Entity)
    		Entity targetEntity = (Entity)context.InputParameters["Target"];
    		if (targetEntity.LogicalName != "email")
    			Email email = targetEntity.ToEntity();
    			email = (from mail in serviceContext.CreateQuery()
    				where (mail.Id == email.Id)
    				select mail).FirstOrDefault();
    			var attachmentQuery = (from a in serviceContext.CreateQuery()
    				where (a.ObjectId == email.ToEntityReference())
    				select a);
    			foreach (var attachment in attachmentQuery)
    				var fileName = attachment.FileName;
    		catch (FaultException e)
    			throw new InvalidPluginExecutionException(e.ToString());

    Error “An unhandled exception occurred in the Silverlight Application” when creating a new site via Silverlight interface

    If you get the above error when creating a new site via the Silverlight interface, here’s what should fix the error:

    Go to Central Admin, klick “Manage Web Applications”, choose “General Settings” and check if Security Validation is turned off. Turn it on!


    You will now be able to create sites using the Silverlight interface again.