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!
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.
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.
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.
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.
Hey Paul, any way to filter away "delete" activities?
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));
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?
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?