SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

In SharePoint 2010, how would you know if someone has logged in?

I looked at the SDK and with the new User Profiles and Social Data sdk, I wasn't able to find this.

share|improve this question

Very good question. You could enable 'view' audit logging and look for events for a user in the Audit log.

share|improve this answer

how bout creating your own login form and simply track that ?

Writing a Custom forms login for Sharepoint 2010

share|improve this answer
I think this would be the obvious route to take. I was hoping with the new Social Data / UserProfiles SDK that they would have some sort of an event we can subscribe to. Something very fundamental to social data. – ShareBear Jan 10 '11 at 16:48

You could use an HTTPModule and track the user yourself.

share|improve this answer

You could combine a HttpModule with the activity feed infrastructure, to get regular updates in a user's feed of, for example, what page they were looking at.

public class ActivityFeedHttpModule : IHttpModule {
    public virtual void Init(HttpApplication app) {
        app.EndRequest += new EventHandler(app_EndRequest);
    private void app_EndRequest(object sender, EventArgs e) {
        bool createevent = true; //do some logic here to only log event every 30 mins based on cookie or something
        if(createevent) {   
            SPServiceContext context = SPServiceContext.GetContext(aSite);
            UserProfileManager m_UPM = new UserProfileManager(context);
            string username = Environment.UserDomainName + "\\" + Environment.UserName;
            UserProfile userProfile = m_UPM.GetUserProfile(username);       
            ActivityEvent activityEvent = ActivityEvent.CreateActivityEvent(m_ActivityManager, activityType.ActivityTypeId, owner, publisher);
            activityEvent.Name = activityType.ActivityTypeName;
            activityEvent.ItemPrivacy = (int)Privacy.Public;
            activityEvent.Owner = owner;
            activityEvent.Publisher = publisher; 
            Link link = new Link();
            link.Href = siteUrl;
            link.Name = communityName;
            activityEvent.Link = link;  
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.