0

If a user has posted to various discussions across a SharePoint web application, how can I get the posts they have made in order to populate a web part (using C#)? Also is it possible to get topics most viewed or replied to? Wanting to do a home page would be something like this:

My Topics                   Popular Topics
----------------------------------------------------------
Topic        Replies        Topic                  Replies
=====        =======        =====                  =======
My Topic     4              Something interesting  120
My Topic 2   0              Not as interesting     40

Need to know the API's to use more than the actual HTML/CSS code to write.

2 Answers 2

1

You should be able to just run a query with SP.list. I haven't really done any work with discussions in 2010, but my understanding is that it's fairly unchanged from 2007. There should be a post count (or similar) column. I have done this in 2007 with a DVWP. You can use the U2U CAML Query tool to determine what the column name is.

In short, I don't think you should have to do anything complex (nothing outside of a straight query anyway).

0

You might be able to use an SPSiteDataQuery to query the site collection, looking for messages or discussions that were posted by the user. I think that Discussions have a content type beginning 0x012002, replies have the type beginning 0x0107

Similarly, I'd use an SPSiteDataQuery to get just Discussions, and order the results - but I'm not sure what field to order by, as I'm not sure what would hold the 'count' of the replies.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.