SharePoint Quick Surveys 1.0.2
Yes….hot on the heels of 1.0.1 is another release of the SharePoint Quick Surveys web part. This is a result of user feedback and makes a couple of small changes and fixes. Thanks to all of you who have taken the time to install the solution and try it out for me. It really is invaluable to have others look at the code and provide feedback.
Anyway, version 1.0.2 is available in the downloads section. The changes are:
- Changed the CAML used to query the survey list to determine if a user had already submitted a response (see below).
- Modified the submit handler slightly to ensure that users are taken straight to the graphical results after clicking submit. In some cases this wasn’t always happening.
Nothing like a bit of user testing to iron out any last bugs- thanks everyone!
For those who are interested, the correct code to determine if the current user has submitted a response to a survey is as follows:
/// <summary>
/// Determines if the user has already responsed to this survey.
/// </summary>
/// <returns>True if the user has already responsed.</returns>
bool AlreadyResponded()
{
SPQuery query = new SPQuery();
query.Query = String.Format("<Where><Eq><FieldRef Name='Author'/><Value Type='User'>{0}</Value></Eq></Where>", SPContext.Current.Web.CurrentUser.LoginName);
return (theList.GetItems(query).Count > 0);
}
I had previosuly made the mistake of forgetting to put Type='User' in the FieldRef element. This results in the query failing.
Hopefully this will be of use to you all. Please keep giving feedback either by posting a comment or sending me an email.

Comment by shanmukha kumari on 15 July 2008:
Thank you very much for providing such a wonderful webpart. The webpart is working fine with a small problem. when I set the suvery list property allow response only one , if the user submitted the survey, the webpart show the results everytime the user logged into the protal. But I am not able to see the chart.
Comment by darren on 15 July 2008:
Hi Shanmukha,
Firstly, can you just make sure you have the latest version. What do you see? Is it images that could not be found in the browser? Try to get the URL of the images by right clicking on them and try it separately in a browser.
Thanks,
Darren
Comment by bjv on 13 August 2008:
The web part works wonderfully with one minor exception. After I respond to the survey I see the results as expected on my home page, but if I navigate to another location such as the shared documents folder and then return to the home page the survey questions are posted again even though I’ve already responded to the survey.
Comment by darren on 16 August 2008:
Hi bjv,
I retested the web part in my environment and didn’t find the problem. There was an issue with an earlier version of the project- are you sure you’re using 1.0.2? Also, are you using anonymous access by any chance?
Cheers,
Darren