Logo 
Search:

Sharepoint Forum

Ask Question   UnAnswered
Home » Forum » Sharepoint       RSS Feeds

Inactive WSS subsites

  Asked By: Evelyn    Date: Aug 21    Category: Sharepoint    Views: 878

I need to notify admins of subsites that have not been active for the past 3 months with an email stating to either activate the site or for us to delete it.

I know that through the Sharepoint Administration you can set this up but it only works for Top level sites.

We have one top level with a whole bunch of sub sites created.

I have found the following code which loops through all the subsites and pulls the last date/time the site was active.

This is great but it relies on the person that's admin on the top level site to be part of the subsites as well.

So, is there code out there that can ensure that
without being part of all the subsites I could still be able to
identify inactive sites regardless.

Dim siteCollection As New SPSite "http://server/ToplevelsiteName")
Dim sites As SPWebCollection = siteCollection.OpenWeb
().GetSubwebsForCurrentUser()
Dim i As Integer

For i = 0 To sites.Count - 1
Response.Write(SPEncode.HtmlEncode(sites(i).Name) & " :: "
& sites(i).Created.ToString() & "<BR>")

Next i

Share: 

 

2 Answers Found

 
Answer #1    Answered By: Peter Peterson     Answered On: Aug 21

The SPSite object that represents the top  level site  has a property called AllWebs which will return all the sites  in the site collection (including the top level  site). If you run this code  as a SharePoint admin, you should be able to access everything.

 
Answer #2    Answered By: Damon Garner     Answered On: Aug 21

Be aware, that not only does the SharePoint dead web code  only apply to
top-level sites, it also requires everyone to confirm that they are
using their sites  every so many days even if they use their Webs
everyday. Also, after a certain number of notifications SharePoint may
delete the entire site  Collection.

 
Didn't find what you were looking for? Find more on Inactive WSS subsites Or get search suggestion and latest updates.




Tagged: