How to get Recently Changed Pages and Blocks for currentUser

nitinanand
Member since: 2017
 

Hi, i am trying to read how to get Recently Changed Content items like pages and blocks to be displayed on a widget. (i know there s a already a recently changed widget available by this is little customized)

After reading this, https://www.epinova.no/en/blog/find-recently-changed-pages/, i thought life would be easy but i count find the class RecentlyChangedPage . any help!

#194734
Jun 29, 2018 10:50
Paul Gruffydd
Member since: 2008
 

Hi,

I think you'd need the activity query service for something like that. You get an instance of IActivityQueryService and call "ListActivitiesAsync" passing in a query for the activities you're after. Here's an example:

var aqs = ServiceLocator.Current.GetInstance<IActivityQueryService>();
var query = new ActivityQuery
{
    ChangedBy = "admin",
    ActivityType = "Content",
    MaxResults = 10,
    Order = ActivityOrder.LatestFirst
};
var activities = await aqs.ListActivitiesAsync(query);

You can also provide an action to the ActivityQuery if you want to be more specific about the activities to list.

#194798
Jul 03, 2018 15:13
nitinanand
Member since: 2017
 

Thanks Paul

But this query does not list out content items that are "Saved" by user. It only list out "Published" and "created" activities. I tried to see if it read saved activities by adding "Action = 4 " in the above activity query but i got no result. 

#194806
Jul 03, 2018 16:10
Paul Gruffydd
Member since: 2008
 

If you want to log the Save event, you'll need to enable that in config by adding enableLogOfContentSave="true" to the <applicationSettings> node inside <episerver> in your web.config. Be warned though, that event gets called automatically as you're editing so expect to get a high volume of records returned. 

#194807
Jul 03, 2018 17:10
Tahir Naveed
Member since: 2010
 

There is a report ("Changed Pages") in admin/reports mode that does the same (kind-of) thing. Try reflecting that and you should be able to find out the API. I did the same in the past but can't remember the api but it is same API.

#194808
Jul 03, 2018 17:16
nitinanand
Member since: 2017
 

Hey Paul, any way to filter away "delete" activities? 

#195202
Jul 17, 2018 16:26
nitinanand
Member since: 2017
 

Hey Paul, any way to filter away "delete" activities? 

#195203
Jul 17, 2018 16:26
Paul Gruffydd
Member since: 2008
 

You can filter your results to a specific action and/or activity type but if you'd like to return all activities except "delete" ones then I think you'd need to get all activities and filter out the delete ones yourself:

var filteredActivities = activities.Where(x => !x.Action.Equals((int)ContentActionType.Delete));
#195207
Jul 17, 2018 19:06
nitinanand
Member since: 2017
 

Thanks Paul

#195229
Jul 18, 2018 9:33
nitinanand
Member since: 2017
 

Can enabling log of content save make the site slow? our client recenly complained that a block takes 8-9 mins to change display (right, left, down etc) from CMS. can this be due to enablingLogOfContentSave=true in web.config? 

#198563
Oct 31, 2018 9:55
Paul Gruffydd
Member since: 2008
 

It's certainly not going to help. As I mentioned above, when you enable the logging of save events you'll be logging considerably more events than you were previously as the save event is called pretty much constantly as the editors edit the pages so it's quite easy for the volume of that data to get out of hand which, depending how it's used, may have a knock-on effect on the performance of the site.

That said, 8-9 minutes sounds like a long time for a request to be delayed. I'd expect the request or DB connection to have timed out long before that. Is that 8-9 mins between making a change and the on-page editor reflecting that change or is it 8-9 minutes between a change being made and that change showing up on the website?

#198584
Oct 31, 2018 14:18
This topic is created over 6 months ago and already resolved. If you have similar question please create new topic and refer to this one.