1

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.

1

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

0

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

Writing a Custom forms login for Sharepoint 2010

1
  • 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
0

You could use an HTTPModule and track the user yourself.

0

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.

http://code.msdn.microsoft.com/activityfeedsconsole

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;  
            activityEvent.Commit();
        }
    }
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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