Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

Title says whole question...

How is possible that survey knows wheather user already responded without author info?

share|improve this question
    
What do you mean under "without author info"? –  Kai Jan 30 '12 at 12:40
    
It means that in columns Author and Editor are three stars ("***"). And there is no other value in the other hidden and system columns that could hold this info... –  jumbo Jan 30 '12 at 14:16

1 Answer 1

up vote 4 down vote accepted

The data is still stored in those author and editor columns, it's just that when it presents it through the API, it changes them to stars. If you are wanting to view it through the UI, in the list settings you can always change the setting to show user names in the survey results to see the users real quick and then switch it back.

Through code here's how I determined if someone could respond to a survey a long time ago (SP 2003/2007 days).

private bool CurrentUserCanVote(SPWeb web, SPList list)
{
    string strPost = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
        //"<ows:HttpVDir/>/_vti_bin/owssvr.dll?Cmd=DisplayPost&PostBody=<ows:Batch>" + 
        "<Method>" +
        "<SetList Scope=\"Request\" name=\"u_" + list.Title + "\"/>" +
        //"<SetVar name=\"Cmd\">DisplayPost</SetVar>" + 
        "<SetVar Name=\"Cmd\">Display</SetVar>" +
        "<SetVar Name=\"XMLDATA\">TRUE</SetVar>" + 
        "<OkToVote></OkToVote>" +
        "</Method>" + 
        //"</ows:Batch>" +
        "";

    string result = web.ProcessBatchData(strPost);
    web.AllowUnsafeUpdates = false;
    switch(result)
    {
        //It is OK for the currently authenticated user to vote in the survey
        case "0":
            return true;
        //The user cannot vote because the survey has no questions.
        case "1":
            return true;
        //The user cannot vote because he or she has already voted in this survey.
        case "2":
            return false;
        default:
            return true;
    }
}

I want to say with SP 2010, i just decided to pull back the dataset as the currently logged in user and see if it was empty. My code then changed to this:

private bool CurrentUserCanVote(DataSet ds, SPList myList)
{
    return (myList.AllowMultiResponses || ds.IsEmpty());
}

I'm not sure if the SP 2010 code will work in all cases...

share|improve this answer
    
That's it. I just looked into SQL and the Author and Editor values are still there. It just can't be viewed through API. Thanks –  jumbo Jan 30 '12 at 14:55

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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