kamagra how much to take

Returning SharePoint Folder Item Count In C#

A question was posted on the newsgroups on how to build a reusable method that could return the item count from a specified folder, here is one that works just fine:

  1. private int GetItemsForFolderInt(SPFolder folder)
  2. {
  3. int i = folder.Files.Count;
  4.  
  5. foreach (SPFolder myFolder in ((IEnumerable) folder.SubFolders))
  6. {
  7. i += GetItemsForFolderInt(myFolder);
  8. }
  9. return i;
  10. }

So, you would of course have to use recursion and recall the method itself within the declaration, and the output of this would just an integer.

:-)

share save 171 16 Returning SharePoint Folder Item Count In C#

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>