zoukankan      html  css  js  c++  java
  • sharepoint插入数据

    View Code
     1      protected void btnsub_Click(object sender, EventArgs e)
     2         {
     3             try
     4             {
     5                 SPSecurity.RunWithElevatedPrivileges(delegate() 
     6                //提高权限
     7                 {
     8                     SPWeb web = SPContext.Current.Web;
     9                    //当前页
    10                     SPList listLeaderMail = web.Lists["领导信箱"];
    11                   //web.Lists后带的为sharepoint表单名称
    12                     SPListItem logItem = listLeaderMail.Items.Add();
    13                     logItem["name"] = txtname.Text;
    14                     if (radfemal.Checked == true)
    15                     {
    16                         logItem["sex"] = radfemal.Text;
    17                     }
    18                     else
    19                     {
    20                         logItem["sex"] = radman.Text;
    21                     }
    22                     logItem["phone"] = txtphone.Text;
    23                     logItem["age"] = txtage.Text;
    24                     //logItem["dept"] = txtdept.Text;
    25                     logItem["dept"] = ddldept.SelectedValue;
    26                     logItem["eMail"] = txtemail.Text;
    27                     logItem["Title"] = txttitle.Text;
    28                     logItem["complaintsContent"] = txtcontent.Text;
    29                     logItem["submitDate"] = DateTime.Now;
    30                     logItem["handleStatus"] = "未处理";
    31                     logItem["replyShow"] = "";
    32                     // logItem["handleResult"] = "不显示";
    33                     logItem.Update();//update
    34     
    35                     Page.ClientScript.RegisterStartupScript(this.GetType(), "leaderMailAlert", "<script>alert('提交成功!请耐心等候领导的回复!');window.location.href='default.aspx'</script>");
    36                     //Response.Redirect("mailList.aspx");
    37                 });
    38 
    39             }
    40             catch (Exception ex)
    41             {
    42 
    43                 SharePointUtility.WriteLog(ex);
    44             }
    45 
    46         }
    1  if (SPContext.Current.Web.CurrentUser != null)
    2                     {
    3                         txtname.Text = SPContext.Current.Web.CurrentUser.Name;
    4      //LoginName为登录名
    5                     }
  • 相关阅读:
    使用cd回到上次编辑的目录
    自动机编程
    python日常题目小练习
    python中的循环结构等相关知识
    python中的数学类型及操作
    小白艰难的Python图像的绘制
    小白的第二天之计算机基础及软件安装
    小白的日常练习
    小白的第一天
    协程
  • 原文地址:https://www.cnblogs.com/double2012/p/2688476.html
Copyright © 2011-2022 走看看