SharePoint – DateTimeControl – unexpected error – iframe – Object reference not set to an instance of an object

Problème

Dans une solution existante, j’ai un contrôle de type DateTime:

<Sharepoint:DateTimeControl ID="DateTimeControl1"  dateonly="true" ShowWeekNumber="true" FirstDayOfWeek="1" FirstWeekOfYear="2" runat="server" EnableViewState="true"></sharepoint:DateTimeControl>

Cependant au lieu d’avoir le contrôle, j’ai eu un message d’erreur à la place (An unexpected error has occurred):

2014-12-10_09-45-35

 

Dans le log ULS:

Medium Application error when access /_layouts/15/iframe.aspx, Error=Object reference not set to an instance of an object. at Microsoft.SharePoint.Utilities.SPUtility.GetThemedImageUrl(String originalUrl, String themeKey) at Microsoft.SharePoint.WebControls.DatePicker..ctor() at Microsoft.SharePoint.WebControls.SPDatePickerControl.InitDatePicker() at Microsoft.SharePoint.WebControls.SPDatePickerControl.set_ShowWeekNumber(Boolean value) at Microsoft.SharePoint.ApplicationPages.DatePickerFrame.Page_Load(Object sender, EventArgs e) at System.EventHandler.Invoke(Object sender, EventArgs e) at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
Unexpected System.NullReferenceException: Object reference not set to an instance of an object. at Microsoft.SharePoint.Utilities.SPUtility.GetThemedImageUrl(String originalUrl, String themeKey) at Microsoft.SharePoint.WebControls.DatePicker..ctor() at Microsoft.SharePoint.WebControls.SPDatePickerControl.InitDatePicker() at Microsoft.SharePoint.WebControls.SPDatePickerControl.set_ShowWeekNumber(Boolean value) at Microsoft.SharePoint.ApplicationPages.DatePickerFrame.Page_Load(Object sender, EventArgs e) at System.EventHandler.Invoke(Object sender, EventArgs e) at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

 

Solution

Il faut créer une collection site à la racine de l’application web (/).

Simple, mais SharePoint est capricieux comme toujours.