Thursday, August 30, 2007

How to Get Survey Data from Sharepoint

Get the Survey data of Site in sharepoint

SPWeb web = SPContext.Current.Web;

string parentUrl = SPContext.Current.Web.Site.RootWeb.Url;


string currentURL = Survey List Url;

SPSite site = new SPSite(currentURL);
SPWebCollection spcollection = site.AllWebs;
string inputsite = p_strUrl ;

SPListCollection myweblist

html += "

";
for (int k = 0; k < spcollection.Count; k++)
{
if (inputsite.ToLower().Trim() == spcollection.Names[k].ToLower().Trim())
{
myweblist = spcollection[k].Lists;
for (int i = 0; i < myweblist.Count; i++)
{
if (myweblist[i].BaseType.ToString() == "Survey")
{
Assignmentvalue = myweblist[i].Title;

string urlAssignmentvalue = myweblist[i].DefaultViewUrl ;

html += "";

}
}
}
}
html += "
>" + Assignmentvalue + "
";

No comments: