Skip to main content

Posts

Showing posts from August, 2011

Power Automate: SharePoint Copy file action fails on file names with a plus (+) sign

SharePoint 2010: SharePoint WebControls mystery

During a project I created a very complex custom newform.aspx / editform.aspx. Usually a custom RenderingTemplate uses the < SharePoint:ListFieldIterator ID="ListFieldIterator1" runat="server"/> control to automatically iterate all fields belonging to that list. But if you use field controls yourself, the ListFieldIterator is so smart not to render that field again. In my case I had to use the same field two times in different views in a multipage tab strip scenario. Within the first view I used this tag: < SharePoint:TextField ID="TextFieldViewA" runat="server" FieldName="TestField" /> In the second view this one: < SharePoint:TextField ID="TextFieldViewB" runat="server" FieldName="TestField" /> When rendering the custom page, SharePoint will only respond to changes on the second field. Somehow SharePoint uses the latest control in the control collection to update and persi

How to correctly display a SPFieldCalculated with datatype DateTime

In this blog I want to talk about my recent experiences with displaying values from a SPFieldCalculated field with datatype "DateTime" in another Web control (asp textbox or label). My first approach was this: // Get calculated due date field values and set them in the textboxes SPFieldCalculated cf3Due = (SPFieldCalculated)SPContext.Current.ListItem.Fields[ "Due date" ]; DueDateField.Text = cf3Due.GetFieldValueAsText(SPContext.Current.ListItem[ "Due_x0020_date" ]); Later I figured out that using the first approach will not correctly apply timezone and region settings to the current datetime values. My next approach solved my issue with displaying the right datetime in the right timezone. But it took me several hours to find out this freaking solution. System.Globalization.CultureInfo ci = null ; SPRegionalSettings regSettings = null ; var user = SPContext.Current.Web.CurrentUser; // Always perform a Null-Check on SPUser.RegionalSettings