Tuesday, May 31, 2011

SharePoint 2010, Event ID 7043: Could not load type 'Microsoft.SharePoint.Portal.WebControls.TaxonomyPicker'

PROBLEM: Every time the application pool is reset the following error appears in the application log.

Load control template file /_controltemplates/TaxonomyPicker.ascx failed: Could not load type
'Microsoft.SharePoint.Portal.WebControls.TaxonomyPicker' from assembly
'Microsoft.SharePoint.Portal, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c'.


ORIGINAL SOLUTION:   It appeared at first that the problem was with a HTML encoded ',' in the assembly reference of the file which I changed by editing the TaxonomyPicker.ascx file.


You can see here that the ',' character has been encoded into
, 


Below you can see the correct way in which the reference should be done.


UPDATED SOLUTION:  The above updates stopped working and the next time an IISRESET happened the error came back.  After doing some research it appears that the TaxonomyPicker is never actually used.  To finally remove the error I just renamed the file to TaxonomyPicker_broken.ascx and the errors went away.

Wednesday, May 25, 2011

User Rights Issues in CRM using JavaScript

I needed to find a way to determine if a user did not exist in CRM or did not have any rights. The devError page is available in both CRM 4 and 2011 and returns the same errors. Also for this to work correctly the user must be in the same domain as CRM and the CRM site url must be in trusted or local intranet sites and passing the authentication automatically.

                    $.ajax({
                                            url: data.serverurl + '/_common/error/devError.aspx',
                                            success: function (data) {
                                                if ($('div pre:contains("[CrmException: No Microsoft Dynamics CRM user exists with the specified domain name and user ID")', data).length > 0)
                                                { accessError = true; }
                                                else if ($('div pre:contains("[CrmException: The user is not assigned any privileges.")', data).length > 0)
                                                { accessError = true; }
                                            },
                                            async: false
                                        });

Wednesday, May 18, 2011

Passing Parameters Between Web Part and User Control

When creating a web part which encapsulates a custom user control the following is one way to utilize the custom attributes for the web part within the user control.

First find the class name of the user control in the code behind of the user control page.

User Control Code Behind - Class Name
Define a web part property in your web part code.  In this case I want users to enter a URL which I will use to load an iframe within the control.

Web Part Code - Property Definition
Next when creating your user control in the web part code make sure to specify the type of the control you are going to add as the class of your user control.  Then you can add attributes to the control which will be accessible when the user control loads.

Web Part Code - CreateChildControls()
Finally you can access the attributes you have added to the control from the code behind on the user control.  In the example below I am retrieving the ViewURL in the user control Page_Load so that I can update an iframe src with the URL I passed.

User Control Code Behind - Page_Load