Question

I am experiencing some problems with the ActivityManager in SP 2010. I want to retrieve a number of events from my "feed". It seems like the GetActivitiesForMe method in the manager has support for taking a DateTime object as a parameter, which will act as a delimiter and return only events that have occured after that DateTime. This is exactly what i am looking for, but it does not seem to work.

This works great:

GetActivitiesForMe();

And returns events from the last 14 days(which seems to be a default-value).

This does not work:

GetActivitiesForMe(DateTime.Now.AddDays(-25))

This returns nothing, not even the items within the last 14 days.

Have anyone else bumped in to this issue?

Was it helpful?

Solution

The default is set through the MinEventTime property of the ActivityManager, if you pass in a date that is older than this it returns nothing.

Try something like this.

var manager = new ActivityManager(mySiteContext);

if (myDate <= manager.MinEventTime)
{
  myEvents = manager.GetActivitiesForMe(manager.MinEventTime);
}
else
{
  myEvents = manager.GetActivitiesForMe(myDate, this.MaxItemsToDisplay); 
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top