I am trying to query all of the items in a discussion list. However, the
SPListItemCollection I get back from calling SPList.Items does not contain
all of the items. A discussion list is made of up two content types, one for
discussion and one for message (the replies) and the SPList.Items property
only appears to be returing the items of the message content type. To test
this, I created a discussion list, created two discusssion entries and then
replied to those with three messages for a total of 5 items. When I call
SPList.Items, it only returns 3 items, all of which are of the message
content type. Interestingly enough however, the SPList.ItemCount property
returns 5. I have tested this on WSS 3.0 with and without SP1. Any ideas?

Re: Problem with SPList.Items for Discussions? by Mike

Mike
Wed Dec 19 23:06:19 CST 2007

Post coding questions to
microsoft.public.sharepoint-development_and_programming where the SP
programming experts are.

It's for all SP products and versions so say (as you did here) which
product/version you have.

You'll find useful earlier (programming) threads there too.

Mike Walsh
WSS FAQ www.wssfaq.com / wss.collutions.com
no private e-mail questions please

vezzoso wrote:
> I am trying to query all of the items in a discussion list. However, the
> SPListItemCollection I get back from calling SPList.Items does not contain
> all of the items. A discussion list is made of up two content types, one for
> discussion and one for message (the replies) and the SPList.Items property
> only appears to be returing the items of the message content type. To test
> this, I created a discussion list, created two discusssion entries and then
> replied to those with three messages for a total of 5 items. When I call
> SPList.Items, it only returns 3 items, all of which are of the message
> content type. Interestingly enough however, the SPList.ItemCount property
> returns 5. I have tested this on WSS 3.0 with and without SP1. Any ideas?

Re: Problem with SPList.Items for Discussions? by Andy

Andy
Thu Dec 20 13:18:49 CST 2007

Having had a quick look at a Discussion list it looks like it holds
discussions in the Folders collection and replies in the Items collection.

Each of the replies has a ParentFolderID property that is the ID of it's
parent in the Folders collection.

Hope this helps
Andy

"vezzoso" <vezzoso@discussions.microsoft.com> wrote in message
news:9FFEFD32-059F-4873-B78E-FC06A8F4B60D@microsoft.com...
>I am trying to query all of the items in a discussion list. However, the
> SPListItemCollection I get back from calling SPList.Items does not contain
> all of the items. A discussion list is made of up two content types, one
> for
> discussion and one for message (the replies) and the SPList.Items property
> only appears to be returing the items of the message content type. To
> test
> this, I created a discussion list, created two discusssion entries and
> then
> replied to those with three messages for a total of 5 items. When I call
> SPList.Items, it only returns 3 items, all of which are of the message
> content type. Interestingly enough however, the SPList.ItemCount property
> returns 5. I have tested this on WSS 3.0 with and without SP1. Any
> ideas?



Re: Problem with SPList.Items for Discussions? by andre

andre
Thu Jan 03 09:01:51 CST 2008

The thing is, Discussions are actually folders and Messages are list
items.
The SPList.ItemCount property returns the number of items and folders
inside the list, whereas SPList.Items.Count returns only the number of
list items (not folders).
That is why you have that difference.