TwitterLinkedInBlog

Wednesday, January 20, 2010

VS2008 - Format XML Document

Edit > Advanced > Format Document

Monday, January 18, 2010

SP2007 - Event Handler AfterProperties DateTime

...
using Microsoft.SharePoint.Utilities
...

// THIS WORKS:
DateTime taskDueDate = Convert.ToDateTime(properties.ListItem[TASK_DUE_DATE_INTERNAL_FIELD_NAME]);

// THIS DOES NOT WORK:
// DateTime taskDueDateAfter = Convert.ToDateTime(properties.AfterProperties[TASK_DUE_DATE_INTERNAL_FIELD_NAME]);

// USE THIS INSTEAD:
string taskDueDateAfterString = properties.AfterProperties[TASK_DUE_DATE_INTERNAL_FIELD_NAME].ToString();
DateTime taskDueDateAfter = SPUtility.CreateDateTimeFromISO8601DateTimeString(taskDueDateAfterString);

Friday, January 15, 2010

SP2007 - SPUser SPFieldUserValue Event Handler

    bool isUserAuthor = false;

    if (properties.ListItem[AUTHOR_INTERNAL_FIELD_NAME] != null)
    {
        SPFieldUserValue authorFieldValue = new SPFieldUserValue(properties.OpenWeb(), properties.ListItem[AUTHOR_INTERNAL_FIELD_NAME].ToString());

        if (authorFieldValue.User.LoginName == properties.UserLoginName)
        {
            isUserAuthor = true;
        }
    }

Thursday, January 14, 2010

SP2007 Quick Launch - Link that opens in new browser window

Site Actions > Site Settings > Quick Launch > New Link > Url > javascript:void window.open('http://www.google.com','_blank');

Relative URLs work as well.