sharepoint 查阅项

内容类型

<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
  <!-- 父内容类型: 项目 (0x01) -->
  <ContentType ID="0x0100c2917396131641a896d310050623ef03"
               Name="Demo - Employee"
               Group="自定义内容类型"
               Description="我的内容类型"
               Inherits="TRUE"
               Version="0">
    <FieldRefs>
      <FieldRef ID="{0A27A629-CB34-4B6D-A68F-9873EAC77CA5}" Name="EmployeeName"/>
      <FieldRef ID="{13E113B0-4E72-4E61-99FB-3E66C671D636}" Name="Sex"/>
      <FieldRef ID="{A7F0556E-FCBF-4698-AC6B-EBE6E91C5CE5}" Name ="Age"/>
      <FieldRef ID="{250E89A0-73D4-44C8-8310-4E152BA848A8}" Name ="Department"/>
    </FieldRefs>
    <XmlDocuments>
      <XmlDocument NamespaceURI="http://schemas.microsoft.com/sharepoint/v3/contenttype/forms/url">
        <FormUrls xmlns="http://schemas.microsoft.com/sharepoint/v3/contenttype/forms/url">
          <New>_layouts/Demo/EmployeeAdd.aspx</New>
        </FormUrls>
      </XmlDocument>
    </XmlDocuments>
  </ContentType>
  <Field  ID="{0A27A629-CB34-4B6D-A68F-9873EAC77CA5}"
            Name="EmployeeName"
            DisplayName="用户名"
            Type="Text"
            SourceID="http://schemas.microsoft.com/sharepoint/v3"
            Required="TRUE"
            StaticName="EmployeeName"/>
  <Field ID="{13E113B0-4E72-4E61-99FB-3E66C671D636}"
         Name="Sex"
         DisplayName="性别"
         Type="Text"
         SourceID="http://schemas.microsoft.com/sharepoint/v3"
         Required="TRUE"
         StaticName="Sex"/>
  <Field ID="{A7F0556E-FCBF-4698-AC6B-EBE6E91C5CE5}"
         Name="Age"
         DisplayName="年龄"
         Type="Text"
         SourceID="http://schemas.microsoft.com/sharepoint/v3"
         Required="TRUE"
         StaticName="Age"/>
  <Field ID="{250E89A0-73D4-44C8-8310-4E152BA848A8}"
         Name="Department"
         DisplayName="部门"
         Type="Lookup"
         ShowField="Department"
         List="Lists/DepartmentList"
         SourceID="http://schemas.microsoft.com/sharepoint/v3"
         Required="TRUE"
         StaticName="Department"/>
</Elements>

 

绑定部门信息

protected void BindDropDownList()
        {
            try
            {

                SPList tempList = SPContext.Current.Web.Lists["DepartmentList"];
                foreach (SPListItem item in tempList.Items)
                {
                    string strTitle = item.Fields.GetFieldByInternalName("DepartmentName").GetFieldValueAsText(item["DepartmentName"]);
                    if (String.IsNullOrEmpty(strTitle))
                    {
                        continue;
                    }
                    this.ddlstDepartment.Items.Add(new System.Web.UI.WebControls.ListItem(strTitle, item.ID.ToString()));
                }
            }
            catch (Exception ex)
            {
                throw;
            }
        }

 

给查阅项赋值

protected void bt_addSubmit_Click(object sender, EventArgs e)
        {
            if (!CheckInput())
                return;
            SPList list = SPContext.Current.Web.Lists["EmployeeList"];
            if (list != null)
            {
                SPListItem item = list.Items.Add();
                if (item != null)
                {
                    item["Title"] = TextBox1.Text.Trim();
                    string name = txtName.Text.Trim();
                    if (name != "")
                    {
                        item["EmployeeName"] = name;
                    }
                    string sex = txtSex.Text.Trim();
                    if (sex != "")
                        item["Sex"] = sex;

                    string age = txtAge.Text.Trim();
                    if (age != "")
                        item["Age"] = age;
                    SPFieldLookupValue lookupValue = new SPFieldLookupValue(int.Parse(this.ddlstDepartment.SelectedValue), this.ddlstDepartment.SelectedItem.Text);
                    item["Department"] = lookupValue;
                }
                item.Update();
            }
            ClosePage(li_pagestring);
        }

转载于:https://www.cnblogs.com/GreenGrass/archive/2013/05/03/3056524.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
SharePoint 是一种用于创建、共享和管理组织内部网站和内容的平台。它可以帮助团队协作、文档管理、数据分享和工作流程自动化。 要入门 SharePoint,以下是一些建议: 1. 了解 SharePoint 的基本概念和术语:熟悉 SharePoint 平台的基本概念,如网站、列表、库、页面和权限等。 2. 注册 SharePoint 网站:注册一个 SharePoint 网站,这是你创建和管理内容的地方。可以尝试使用 Microsoft 365 订阅或 SharePoint Online 进行注册。 3. 探索 SharePoint 网站:浏览你的 SharePoint 网站,了解其组织结构和功能。探索不同的模板和页面布局,以获取更多想法。 4. 创建列表和库:使用列表和库来组织和存储内容。例如,创建一个文档库来存储文件,或创建一个任务列表来跟踪团队的工作。 5. 学习权限管理:了解如何设置和管理用户权限,以确保只有授权人员可以访问和编辑内容。 6. 配置工作流程:利用 SharePoint 的工作流程功能来自动化业务过程。学习如何创建和配置工作流程,以提高生产力和效率。 7. 使用 SharePoint 应用程序:探索 SharePoint 应用程序,这些应用程序可以增强和扩展 SharePoint 的功能。例如,Power Automate 可以帮助你创建自定义工作流程,Power Apps 可以帮助你构建自定义应用程序。 8. 学习 SharePoint 开发:如果你具有开发经验,可以学习 SharePoint 开发来自定义和扩展 SharePoint 的功能。了解 SharePoint Framework (SPFx) 和 SharePoint Designer 等工具。 以上是入门 SharePoint 的一些建议。探索不同的功能和实践,逐步熟悉平台,并根据你的需求进行定制和配置。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值