Wednesday, April 4, 2012

News feed with CQWP

How come I always tell the company I work or consult for, that I am not a developer.. and then I always end up developing stuff anyway? For my part, it is more of a frustration part, because it takes so much time to develop than to use the out of the box functionality. But sometimes out of the box is just not enough.

The last few months I have been working on setting up a SP 2010 server farm from scratch, setting up a new intranet, branded it, structuring it and... developing some parts like the News rollup. I have used the CQWP and it is so powerful, I love it. I have built kind of a Facebook news stream with it, that rolls up news from all departments, the site image and source where the news comes from and also ratings and news images.

This is the result:

And here is an explanation of the parts on the news webpart:



This is how I built the CQWP:

I have built a custom news page layout, where I have a site column called "Siteimage" where I store the actual site image. (The site image is marked with a red number 1 in the image above). So there will be different site images depending on where the news are created. In this case I have for example a picture of a vessel if the news comes from a vessel site. And that is how Facebook news feed works, you have the source image to the left in the news feed (the profile picture) and if you click on the news you will land on that persons wall. This works the same way, but you will land on the site where the news was created.

Red number 2 in the picture above shows that I have selected the Title and Byline and the title is the URL to the news page.

Then I have added the site title (our sites are named by department), the Author and the Article Date as red number 3 shows in the picture above.

Of course any thumbnail photos are displayed and you can make them clickable so they enlarge on click (red number 4 in picture above)

And last, I wanted to add the ratings since I like the social interaction also. Red number 5 in pic above, if not obvious :) In fact, I also have added the Note board to our news, so if you open the news page you can post comments on it. I have not added the "Comments" though on the front page, since I have not found any good way to do that. I don't think the Note board comments are connected to the page itself, but maybe someone out there knows? I have found a way to display comments on Blogs, but not on Page libraries.

My next news project will be based completely on Blogs. There are many reasons for that: it is so easy to blog (and use Word if the user wants to), the entire news is displayed, you can display ratings and number of comments, I have built the similiar news feed as above but using Blog instead.

I really like the CQWP but I wish it was even more flexible and that you could perform lookups on custom fields and values a bit easier. And maybe a drag and drop GUI to build the CQWP without having to export and import it, copy and modify xsl etc. Also, you need to be very creative and use your imagination to find the solution on how to bring out the stuff you want to show in your CQWP.

No comments: