TwitterLinkedInBlog

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;
        }
    }

No comments: