Yesterday someone asked me how to get the datepart (f.e. the year of a date) inside a SharePoint designer workflow. I thought it would be some default action in the "Utility Actions" group, but I thought wrong. There is no such pretty common action. This post however shows a simple technique to get datepart Year, Month and Day.
How to
First you have to start by asigning a new workflow string variable to a date value, and make sure to select the ISO Formatted option for the return field as parameter. This will set the string variable to something like 2010-12-28 according to the ISO format(yyyy-mm-dd).
We can now use the Utility Actions for string variables to extract our Year, Month and Day.

Cheers,
Wes
In a project I'm working on we wanted to use Office Web Apps in SP2010 to preview selected documents in the browser. To do so we've created a very simple web part that renders an I-Frame with the URL set to one of the Office Web Apps urls depending on the document extension. Unfortunately the X-Frame header, that is added by the Office Web Apps service, prevents Internet Explorer to render the documents in an I-Frame! To solve this we've create a very simple HttpModule that checks for the header and changes the value from "DENY" to "SAMEORIGIN". This post simply shows the code for such a module that enables previewing of documents with Office Web Apps inside an I-Frame
The code
/// <summary>
/// The XFrameOptionsModule loosens the x-frame policy from DENY to SAMEORIGIN
/// </summary>
public class XFrameOptionsModule : IHttpModule
{
private const string XFrameOptionsHeaderName = "X-FRAME-OPTIONS";
/// <summary>
/// Initializes a new instance of the <see cref="XFrameOptionsModule"/> class.
/// </summary>
public XFrameOptionsModule()
{
}
/// <summary>
/// Disposes of the resources (other than memory) used by the module that implements <see cref="T:System.Web.IHttpModule"/>.
/// </summary>
public void Dispose()
{
}
/// <summary>
/// Initializes a module and prepares it to handle requests.
/// </summary>
/// <param name="context">An <see cref="T:System.Web.HttpApplication"/> that provides access to the methods, properties, and events common to all application objects within an ASP.NET application</param>
public void Init(HttpApplication context)
{
context.PreSendRequestHeaders += ChangeXFrameOptionsHeaderToSameOrigin;
}
/// <summary>
/// Changes the X-Frame-Options "DENY" header to "SAMEORIGIN".
/// </summary>
/// <param name="sender">The HttpApplication that triggers the event.</param>
/// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
private void ChangeXFrameOptionsHeaderToSameOrigin(object sender, EventArgs e)
{
HttpApplication application = (HttpApplication)sender;
HttpResponse response = application.Response;
string headerValue = response.Headers[XFrameOptionsHeaderName];
if (headerValue != null && headerValue.Equals("DENY", StringComparison.OrdinalIgnoreCase))
{
response.Headers[XFrameOptionsHeaderName] = "SAMEORIGIN";
}
}
}
All you have to do now is to add this module to the web.config using a SPWebConfigModification inside a feature receiver.
Cheers,
Wes