zoukankan      html  css  js  c++  java
  • 取splist的某个字段的值

    LeaveConfig是字典表,通过某个编码获取该编码对应的值,可输入编码做为查询条件查不到记录.原因为编码是字段显示的名称而不是字段的名称

    编码 审批人
    HrUser sportdog

    SPSite site = new SPSite("http://gwsps03");
                SPWeb web = site.OpenWeb();
                SPList lists = web.Lists.TryGetList("LeaveConfig");
                SPQuery query = new SPQuery();
                query.Query = "<Where><Eq><FieldRef Name='_x7f16__x7801_'/>" +
                    "<Value Type='Text'>HrUser</Value></Eq></Where>";
                SPListItemCollection items = lists.GetItems(query);
                Response.Write(items.Count + items[0]["审批人"].ToString());

    From MSDN:

    SPField.StaticName 属性
    Gets or sets the internal name of the field.
    属性值
    A string that specifies the internal name of the field.

    SPField.InternalName 属性
    Gets the internal name that is used for the field.
    属性值
    A string that contains the internal name.

    SPField.Title 属性
    Gets or sets the display name for the field.
    属性值
    A string that contains the display name.

    所以:

    StaticName和InternalName的区别,应该是InternalName是read-only,而StaticName不是。

  • 相关阅读:
    【Linux设备驱动程序】Chapter 2
    【Linux设备驱动程序】Chapter 1
    sed 命令多行到多行的定位方式
    chmod 与大写 X
    C 语言中模板的几种实现方式
    /etc/default/grub 部分配置选项设置
    fcitx error
    QT5学习过程的小问题集锦
    Qt4编码
    Qt MainWindow结构
  • 原文地址:https://www.cnblogs.com/sportdog/p/2994436.html
Copyright © 2011-2022 走看看