In one of my project's implementations the SharePoint
DateTimeControl has stopped working altogether and users with
"Contribute" access were getting access denied to the field. In other
words, the Calendar control was not opening, see below
It was
referred like this in my application page
<SharePoint:DateTimeControl ID="dtselDate"
runat="server"
DateOnly="true"
IsRequiredField="true"
CssClassTextBox="ms-input"
/>
The Problem Background:
Actually DateTimeControl
field uses the iframe calender page to render the actual
calender. The location of iframe.aspx is C:\Program
Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\LAYOUTS
The
problem appeared to be with managed paths in the site collections,
the Users with "Contribute access" were accessing the following path:
http://myserver/_layouts/iframe.aspx (Path to Root site collection
where user doesn't have access)
However, the actual path
should be http://myserver/sites/sitecollection/_layouts/iframe.aspx (Path
to actual site collection where user HAVE valid access)
The solution:
The
solution is pretty simple i.e. to set DatePickerFrameUrl to use the
magic tokens $SPUrl SiteCollection (see below), which will
ensure Contributers will access the right Site Collection.
DatePickerFrameUrl
= "<% $SPUrl:~SiteCollection/_layouts/iframe.aspx %>" DateOnly="true"
runat="server" />
~site/ is an equivalent to SPContext.Current.Web.ServerRelativeUrl
~sitecollection/ is an equivalent to SPContext.Current.Site.ServerRelativeUrl
Reference
No comments:
Post a Comment