sharepoint 中的调查结果

发布于 07-09 01:35 字数 166 浏览 12 评论 0原文

我如何获取已完成或未完成或未回复调查的用户列表。

所以我有一个调查,可以说“调查A”。 在这项调查中,我有一份必须填写调查的人员或团体的名单。 sharepoint 已经为我们提供了一份受访者名单,但我想列出一份尚未回复或未完成调查的人员名单。

我正在使用c#,谢谢..

how do i get a list of user that have completed or not completed or not responded to a survey.

so i have a survey, lets say "survey A". in this survey i have a list of people or groups that must fill the survey. sharepoint already gives us a list of respondents, but i want to make a list of people that have not responded or not completed the survey.

i'm using c#, thanks..

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

话少心凉2024-07-16 01:35:47

假设您的调查被标记为非匿名,并且人们不能多次回答调查,您可以执行以下操作:

  1. 获取必须填写调查的人员列表。
  2. 迭代调查中的项目(每个项目都是来自一个人的回复)。
  3. 从第 1 部分的人员列表中删除创建该项目的人员。(SharePoint 调查将回答调查的人员保留为该项目的“创建者”/“作者”属性)

结果将是必须的人员列表回答调查,但尚未这样做。

Assuming that your survey is marked as non-anonymous, and that people can't answer the survey more than once, you can do the following:

  1. Take the list of people that MUST fill the survey.
  2. Iterate over the items in the survey (each item is a response from a single person).
  3. Remove the person that created that item from the list of people from section 1. (SharePoint surveys keep the person that answered the survey as the "Creator"/"Author" property of the item)

The result will be the list of people that MUST answer the survey, but haven't done so yet.

想念有你2024-07-16 01:35:47
private DataTable GetUser()
{
    //SPGroup User = null;

    DataTable dt = new DataTable();
    dt.Columns.Add("Survey Remeaning User");

    DataTable dtuser = new DataTable();
    dtuser.Columns.Add("Survey Completed User");


    try
    {
        SPSecurity.RunWithElevatedPrivileges(delegate()
        {
            using (SPSite objSubSite = new SPSite(SPContext.Current.Site.Url))
            {
                SPUserCollection userCollection = SPContext.Current.Web.Groups["Survey Members"].Users;
                foreach (SPUser user in userCollection)
                {
                    StringBuilder sb = new StringBuilder();
                    sb.Append("<Where>");
                    sb.Append("<Eq>");
                    sb.Append("<FieldRef Name='Author' />");
                    sb.Append("<Value Type='User'>" + user + "</Value>");
                    sb.Append("</Eq>");
                    sb.Append("</Where>");

                    // query.ViewFields = "<FieldRef Name='Author'/>";
                    SPQuery query = new SPQuery();
                    query.Query = sb.ToString();

                    using (SPWeb objWeb = objSubSite.OpenWeb())
                    {
                        int i = objWeb.Lists["SurveyList"].GetItems(query).Count;
                        if (i == 0)
                        {
                            dt.Rows.Add(user);
                            GvUser.DataSource = dt;
                            GvUser.DataBind();
                        }
                        //if (i == 1)
                        else
                        {
                            //DataTable dtuser = new DataTable();
                            //dt.Columns.Add("SurveyCompleted");
                            dtuser.Rows.Add(user);
                            GvComUser.DataSource = dtuser;
                            GvComUser.DataBind();
                        }
                    }
                }
            }
        });
    }
    catch (Exception)
    {


    }
    return dt;
}

您必须在用户和组中创建一个组,然后在其中添加用户。
然后你可以使用上面的功能并在页面加载中添加该功能....
我通过在网格视图中添加颜色来显示结果

private DataTable GetUser()
{
    //SPGroup User = null;

    DataTable dt = new DataTable();
    dt.Columns.Add("Survey Remeaning User");

    DataTable dtuser = new DataTable();
    dtuser.Columns.Add("Survey Completed User");


    try
    {
        SPSecurity.RunWithElevatedPrivileges(delegate()
        {
            using (SPSite objSubSite = new SPSite(SPContext.Current.Site.Url))
            {
                SPUserCollection userCollection = SPContext.Current.Web.Groups["Survey Members"].Users;
                foreach (SPUser user in userCollection)
                {
                    StringBuilder sb = new StringBuilder();
                    sb.Append("<Where>");
                    sb.Append("<Eq>");
                    sb.Append("<FieldRef Name='Author' />");
                    sb.Append("<Value Type='User'>" + user + "</Value>");
                    sb.Append("</Eq>");
                    sb.Append("</Where>");

                    // query.ViewFields = "<FieldRef Name='Author'/>";
                    SPQuery query = new SPQuery();
                    query.Query = sb.ToString();

                    using (SPWeb objWeb = objSubSite.OpenWeb())
                    {
                        int i = objWeb.Lists["SurveyList"].GetItems(query).Count;
                        if (i == 0)
                        {
                            dt.Rows.Add(user);
                            GvUser.DataSource = dt;
                            GvUser.DataBind();
                        }
                        //if (i == 1)
                        else
                        {
                            //DataTable dtuser = new DataTable();
                            //dt.Columns.Add("SurveyCompleted");
                            dtuser.Rows.Add(user);
                            GvComUser.DataSource = dtuser;
                            GvComUser.DataBind();
                        }
                    }
                }
            }
        });
    }
    catch (Exception)
    {


    }
    return dt;
}

you have to create a group in user and group and add user in that.
and then u can can user above function and add th function in page load....
i have show the result in grid view by adding coloums in it

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文