We all SharePoint Developers use SP object model . Don't we? What's the difference between. list.Items.Count and list.ItemCount ( list being a SPList object)
Before we answer this Question, Lets see what are different view scopes present in a list.
View Scope
SPViewScope is a SharePoint enumeration, which has values Default, FilesOnly, Recursive, RecursiveAll.
->Folder 1
Item 1
Item 2
->Item 3
Consider a SHAREPOINT list which has items in the above hierarchy.i.e. 'Folder 1' and 'Item 3' directly at the top level and 'Item 1 ,Item 2' inside the 'Folder 1 '.
Now lets set different scopes and check out what items are seen in the view.
Note : The scope can be set to SPview.Scope or to an SPQuery.Scope
Default
Before we answer this Question, Lets see what are different view scopes present in a list.
View Scope
SPViewScope is a SharePoint enumeration, which has values Default, FilesOnly, Recursive, RecursiveAll.
->Folder 1
Item 1
Item 2
->Item 3
Consider a SHAREPOINT list which has items in the above hierarchy.i.e. 'Folder 1' and 'Item 3' directly at the top level and 'Item 1 ,Item 2' inside the 'Folder 1 '.
Now lets set different scopes and check out what items are seen in the view.
Note : The scope can be set to SPview.Scope or to an SPQuery.Scope
Default
- Folder1
- Item3
- Item 3
Recursive
- Item 1
- Item 2
- Item 3
- Folder 1
- Item 1
- Item 2
- Item 3
- list.Items.Count : 3. Does not include folder, but includes items inside folders
- list.ItemCount : 4. Includes folders as well as items inside folders.
0 comments:
Post a Comment