Purtroppo gli item usati nei forum thread –> post hanno un comportamento diverso rispetto a tutti gli altri item.
Nel mio caso tutti i forum hanno nel titolo un prefisso di tipo forum.
Cmq per poter ottenere quello che mi serviva ho potuto scrivere queste poche righe di codice:
using (SPSite site = new SPSite(args[0])) { SPWeb web = site.OpenWeb(); var listCollection = web.Lists; IEnumerablelists = listCollection.Cast (); IEnumerable forums = lists.Where(w => w.Title.ToLower().StartsWith("forum") && !w.Hidden); if (forums == null) { Console.WriteLine("Non sono stati trovati forums"); return; } foreach (SPList forum in forums) { SPListItemCollection threads = forum.Folders; foreach (SPListItem item in threads) Console.WriteLine(forum.Title + "\t\t\t\t\t" + item.Title + "\t\t\t\t\t" + item.Folder.ItemCount); } }
Spero possa tornarvi utile
No comments:
Post a Comment