Solved

sharepoint monitor the nr of items in a list or document library.

Posted on 2012-03-15
1
250 Views
Last Modified: 2012-04-26
Hi,

I want to create a script so i can monitor the evolutions of number of items in sharepoint 2007 document libraries. (powershell, vbs, ...)

=> i want to insert this in an sql table, or use kaseya monitoring.

=> the lists are very large and i want to have a consitent evolutions of the nr of items in the list. for performance and provisioning.

Can anyone help me out?

thanks a lot
0
Comment
Question by:capsugel
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 14

Accepted Solution

by:
KoenVosters earned 500 total points
ID: 37728166
Best way would be to create a custom timer job that goes through your lists every day/week during the night, as going through the lists will slow down your environment. The last part of code I had to write from memory so double check it in your compiler :)

http://www.andrewconnell.com/blog/articles/CreatingCustomSharePointTimerJobs.aspx

This code will give you the count information

//Use SPSite constructor with URL for main site to return a site collection
SPSite siteCollection = new SPSite(siteUrl);

//Return the target web site based on site name
SPWeb site = siteCollection.AllWebs[siteName];

//Return a collection of list items based on the Items property
//for the specific named list

foreach (SPList list in site.Lists)
{
int itemCount = list.Items.Count; //save this to your SQL database with the listname
}
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In case you ever have to remove a faulty web part from a page , add the following to the end of the page url ?contents=1
A recent project that involved parsing Tableau Desktop and Server log files to extract reusable user queries for use in other systems. I chose to use PowerShell to gather the data, and SharePoint to present it...
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

710 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question