private List <SurveyResponseSummary> GetResponses(HttpContext context) { List <SurveyResponseSummary> lstReturn = new List <SurveyResponseSummary>(); string strList = context.Request["List"] == null ? mcstrResponseList : context.Request["List"]; string strTemplateList = context.Request["TemplateList"] == null ? mcstrTemplateList : context.Request["TemplateList"]; using (SPWeb web = SPContext.Current.Web) { try { SPList lst = web.Lists.TryGetList(strList); if (lst != null) { SPView vwSpecified; SPListItemCollection items; if (context.Request.QueryString["ListView"] != null) { vwSpecified = lst.Views[context.Request.QueryString["ListView"]]; } else { vwSpecified = lst.DefaultView; } items = lst.GetItems(vwSpecified); foreach (SPListItem item in items) { SurveyResponseSummary rspThis = new SurveyResponseSummary(item, strTemplateList); lstReturn.Add(rspThis); } } else { context.Response.StatusCode = 500; context.Response.StatusDescription = "DWF Survey: Specified Responses List Not Found"; } } catch (Exception ex) { context.Response.StatusCode = 500; context.Response.StatusDescription = "DWF Survey: " + ex.Message; } } return(lstReturn); }
private List<SurveyResponseSummary> GetResponses(HttpContext context) { List<SurveyResponseSummary> lstReturn = new List<SurveyResponseSummary>(); string strList = context.Request["List"] == null ? mcstrResponseList : context.Request["List"]; string strTemplateList = context.Request["TemplateList"] == null ? mcstrTemplateList : context.Request["TemplateList"]; using (SPWeb web = SPContext.Current.Web) { try { SPList lst = web.Lists.TryGetList(strList); if (lst != null) { SPView vwSpecified; SPListItemCollection items; if (context.Request.QueryString["ListView"] != null) { vwSpecified = lst.Views[context.Request.QueryString["ListView"]]; } else { vwSpecified = lst.DefaultView; } items = lst.GetItems(vwSpecified); foreach (SPListItem item in items) { SurveyResponseSummary rspThis = new SurveyResponseSummary(item, strTemplateList); lstReturn.Add(rspThis); } } else { context.Response.StatusCode = 500; context.Response.StatusDescription = "DWF Survey: Specified Responses List Not Found"; } } catch (Exception ex) { context.Response.StatusCode = 500; context.Response.StatusDescription = "DWF Survey: " + ex.Message; } } return lstReturn; }