Thursday, September 24, 2009

Blank UpdatePanel in UserControl

Scenario
  • Editing a UserControl in VS 2008 with html <style> tags in the UserControl
Issue
  • The Designer window is empty as if the updatepanel is invisible (visible=false)
Resolution
  • Place the Style tags at the bottom of the usercontrol, below any UpdatePanels
    • This is a known bug

Monday, September 21, 2009

Personalization and Audience Targeting Reset Page Content Bug

Scenario
  • Personalization and Web Part Audience Targeting are both enabled on a MOSS 2007 page.
  • Some web parts are audience trimmed for a particular user
  • That user personalizes the page
  • The user selects "Reset Page Content" from the User Welcome Menu
    • Or they select "Reset Web Part Content" from the Web Part's "Edit" menu
Issue
  • The audience trimmed web parts are incorrectly shown to the user
    • This may be a security issue if the audience targeted web part has confidential information on it
  • After refreshing the page, the page displays correctly
Resolution
  • I developed the following simple workaround
Workaround
  • Add the following usercontrol (2 files) to the 12 Hive\Template\ControlTemplates folder
    • PersonalizationResetPageContentRefreshBugFix.ascx
    • <%@ Control Language="VB" AutoEventWireup="false" CodeFile="PersonalizationResetPageContentRefreshBugFix.ascx.vb" Inherits="UserControls_PersonalizationResetPageContentRefreshBugFix" %>
    • PersonalizationResetPageContentRefreshBugFix.ascx.vb
    • Partial Class UserControls_PersonalizationResetPageContentRefreshBugFix
          Inherits System.Web.UI.UserControl
      
          Protected Sub Page_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.PreRender
              Dim strPageRestore As String = Request.Form.Get("MSOWebPartPage_RestorePageDefault")
              Dim strPartRestore As String = Request.Form.Get("MSO_RestoreSettings")
              If Not String.IsNullOrEmpty(strPageRestore) OrElse _
                      Not String.IsNullOrEmpty(strPartRestore) Then
                  'Force a client side redirect and end response so no untargeted info goes to client.
                  Response.Redirect(Page.Request.Url.AbsoluteUri, True)
                  'Response Ends
              End If
          End Sub
      End Class
  • Add the following lines to each master page where personalization and audiences are used
    • The following line goes with the other Register tags at the top of the master page
      <%@ Register TagPrefix="wssuc" TagName="PersonalizationResetBugFix" src="~/_controltemplates/PersonalizationResetPageContentRefreshBugFix.ascx" %>
      
    • The following line goes within the BODY/FORM section
    • <wssuc:PersonalizationResetBugFix id="IdPersonalizationResetBugFix" runat="server" EnableViewState="false"/>

Monday, September 14, 2009

Error enabling Publishing Feature - WebAdminPageBase.OnLoad File Not Found

Scenario
  • Enabling the Publishing Feature on a new Team Site
  • Accessing the site via a url not mapped in the Alternate Access Mappings list
Issue
  • Encountered the WebAdminPageBase.OnLoad "File Not Found" error
Resolution
  • Add the Alternate Access Mapping for the url you are trying to use

MS SharePoint "so-called" Support

Some of my open/past SharePoint support issues.  Note that I always post my MS Support Tickets to the MS newsgroups with an issue to foster community participation and help others.

Open (Or given up on) Issues
  • None at this time.
Issues Resolved by Me
Issues Resolved by Community
Issues Resolved by MS
  • You think there'd be one. :-(

Domain Username not resolving - People Picker

Scenario
  • You attempt to specify a domain user in any People Picker field within SharePoint 2007 / 3.0
  • AD domain users have resolved before.
  • The application service is running under a local machine account
Issue
  • The username will not resolve.  Instead you get the squiggly red underline.
Resolution
  • Workaround: Change the Service Account to a domain user account

I do not know why a local account would exhibit this behaviour nor why this would randomly stop working.  After changing to a domain account temporarily you can change back to a local account, but the issue will occur again.  My guess is that it's environment specific, such as a temporary loss of AD connectivity, which would explain the intermittant occurances.

Tuesday, September 8, 2009

SPUtility.SendEmail

Issues with SPUtility.SendEmail.
  • SPUtility.SendEmail subject parameter cannot contain a comma "," character.
    • If it does, the email will be delayed by several hours.
    • To workaround, use: strSubject.Replace(",", " ") for the subject parameter
    • I am not sure if this is an smtp issue or a SPUtility issue.
    • The function will return "True" indicating a successful send even if there is a comma.
  • The body text parameter must have a new line character at least every 2048 characters.
    • If not, the email body will be truncated at 2048 chars.
    • For example, when using an HTML formatted body, you may have all your encoding on one line within the body string/stringbuilder parameter. You will need to insert crlf chars every 2048 characters or less.