ListItem 类

Represents an item or row in a list.

继承层次结构

System.Object
  Microsoft.SharePoint.Client.ClientObject
    Microsoft.SharePoint.Client.SecurableObject
      Microsoft.SharePoint.Client.ListItem

命名空间:  Microsoft.SharePoint.Client
程序集:   Microsoft.SharePoint.Client.Silverlight(位于 Microsoft.SharePoint.Client.Silverlight.dll 中);  Microsoft.SharePoint.Client.Phone(位于 Microsoft.SharePoint.Client.Phone.dll 中)  Microsoft.SharePoint.Client(位于 Microsoft.SharePoint.Client.dll 中)

语法

声明
Public Class ListItem _
    Inherits SecurableObject
用法
Dim instance As ListItem
public class ListItem : SecurableObject

备注

Contains CSOM expando fields, which correspond to the fields defined in the parent list. The CSOM expando field name is the name of the field defined in the list and the CSOM expando field value is the field value in the list item. The following table defines the mapping between field types and values.

Field Type

CSOM Expando Field Value Type

Meaning

Integer

When its value is undefined it must be CSOM 空引用(无 在 Visual Basic 中), otherwise it must be CSOM Int32.

Field allows an integer value.

Text

When its value is undefined it must be CSOM 空引用(无 在 Visual Basic 中), otherwise it must be CSOM String.

Field allows a limited-length string of text.

Note

When its value is undefined it must be CSOM 空引用(无 在 Visual Basic 中), otherwise it must be CSOM String.

Field allows larger amounts of text.

DateTime

When its value is undefined it must be CSOM 空引用(无 在 Visual Basic 中), otherwise it must be CSOM DateTime.

Field allows full date and time values, as well as date-only values.

Counter

It must be CSOM Int32.

Counter is a monotonically increasing integer field, and has a unique value in relation to other values that are stored for the field in the list. Counter is used only for the list item identifier field, and not intended for use elsewhere.

Choice

When its value is undefined it must be CSOM 空引用(无 在 Visual Basic 中), otherwise it must be CSOM String.

Field allows selection from a set of suggested values. A choice field supports a field-level setting which specifies whether free-form values are supported.

Lookup

When its value is undefined it must be CSOM 空引用(无 在 Visual Basic 中), otherwise it must be CSOM Object.

Field allows a reference to another list item. The field supports specification of a list identifier for a targeted list. An optional site identifier can also be specified, which specifies the site of the list which contains the target of the lookup.

Boolean

When its value is undefined it must be CSOM 空引用(无 在 Visual Basic 中), otherwise it must be CSOM Boolean.

Field allows a true or false value.

Number

When its value is undefined it must be CSOM null, otherwise it must be CSOM Double.

Field allows a positive or negative number. A number field supports a field level setting used to specify the number of decimal places to display.

Currency

When its value is undefined it must be CSOM 空引用(无 在 Visual Basic 中), otherwise it must be CSOM Double.

Field allows for currency-related data. The Currency field has a CurrencyLocaleId property which takes a locale identifier of the currency to use.

URL

When its value is undefined it must be CSOM 空引用(无 在 Visual Basic 中), otherwise it must be CSOM Object.

Field allows a URL and optional description of the URL.

Computed

N/A

Field renders output based on the value of other columns.

Threading

When its value is undefined it must be CSOM 空引用(无 在 Visual Basic 中), otherwise it must be CSOM String.

Contains data on the threading of items in a discussion board.

Guid

When its value is undefined it must be CSOM 空引用(无 在 Visual Basic 中), otherwise it must be CSOM GUID.

Specifies that the value of the field is a GUID.

MultiChoice

When its value is undefined it must be CSOM 空引用(无 在 Visual Basic 中), otherwise it must be CSOM Array.

Field allows one or more values from a set of specified choices. A MultiChoice field can also support free-form values.

GridChoice

When its value is undefined it must be CSOM 空引用(无 在 Visual Basic 中), otherwise it must be CSOM Array.

Grid choice supports specification of multiple number scales in a list.

Calculated

N/A

Field value is calculated based on the value of other columns.

File

When its value is undefined it must be CSOM 空引用(无 在 Visual Basic 中), otherwise it must be CSOM String.

Specifies a reference to a file that can be used to retrieve the contents of that file.

Attachments

When its value is undefined it must be CSOM 空引用(无 在 Visual Basic 中), otherwise it must be CSOM Boolean.

Field describes whether one or more files are associated with the item. See Attachments for more information on attachments. true if a list item has attachments, and false if a list item does not have attachments.

User

When its value is undefined it MUST be CSOM 空引用(无 在 Visual Basic 中), otherwise it must be CSOM Object.

A lookup to a particular user in the User Info list.

Recurrence

When its value is undefined it MUST be CSOM 空引用(无 在 Visual Basic 中), otherwise it must be CSOM Boolean.

Specifies whether a field contains a recurrence pattern for an item.

CrossProjectLink

When its value is undefined it MUST be CSOM 空引用(无 在 Visual Basic 中), otherwise it must be CSOM Boolean.

Field allows a link to a Meeting Workspace site.

ModStat

When its value is undefined it MUST be CSOM 空引用(无 在 Visual Basic 中), otherwise it must be CSOM int32.

Specifies the current status of a moderation process on the document.

Error

N/A

Specifies errors. Value = 24.

ContentTypeId

When its value is undefined it MUST be CSOM 空引用(无 在 Visual Basic 中), otherwise it MUST be CSOM Object.

Field contains a content type identifier for an item. ContentTypeId conforms to the structure defined in ContentTypeId.

PageSeparator

N/A

Represents a placeholder for a page separator in a survey list. PageSeparator is only intended to be used with a Survey list.

ThreadIndex

When its value is undefined it must be CSOM 空引用(无 在 Visual Basic 中), otherwise it must be CSOM String.

Contains a compiled index of threads in a discussion board.

WorkflowStatus

When its value is undefined it must be CSOM 空引用(无 在 Visual Basic 中), otherwise it must be CSOM Int32.

Contains status on a running workflow for a particular item.

AllDayEvent

When its value is undefined it must be CSOM 空引用(无 在 Visual Basic 中), otherwise it must be CSOM Boolean.

The AllDayEvent field is only used in conjunction with an Events list. true if the item is an all day event (that is, does not occur during a specific set of hours in a day).

WorkflowEventType

When its value is undefined it must be CSOM 空引用(无 在 Visual Basic 中), otherwise it must be CSOM Int32.

A description of a type of a historical workflow event. See WorkflowEventType Enumeration for more information.

Facilities

When its value is undefined it must be CSOM 空引用(无 在 Visual Basic 中), otherwise it must be CSOM Array.

FreeBusy

When its value is undefined it must be CSOM 空引用(无 在 Visual Basic 中), otherwise it must be CSOM String.

Overbook

When its value is undefined it must be CSOM 空引用(无 在 Visual Basic 中), otherwise it must be CSOM String.

Confidential

When its value is undefined it must be CSOM 空引用(无 在 Visual Basic 中), otherwise it must be CSOM Boolean.

WhatsNew

When its value is undefined it must be CSOM 空引用(无 在 Visual Basic 中), otherwise it must be CSOM Boolean.

DueDate

When its value is undefined it must be CSOM 空引用(无 在 Visual Basic 中), otherwise it must be CSOM DateTime.

AllowEditing

When its value is undefined it must be CSOM 空引用(无 在 Visual Basic 中), otherwise it must be CSOM Boolean.

SendTo

When its value is undefined it must be CSOM 空引用(无 在 Visual Basic 中), otherwise it must be CSOM Array

Confirmations

When its value is undefined it must be CSOM 空引用(无 在 Visual Basic 中), otherwise it must be CSOM String.

CallTo

When its value is undefined it must be CSOM 空引用(无 在 Visual Basic 中), otherwise it must be CSOM Array.

CallTime

When its value is undefined it must be CSOM 空引用(无 在 Visual Basic 中), otherwise it must be CSOM DateTime.

Whereabout

When its value is undefined it must be CSOM 空引用(无 在 Visual Basic 中), otherwise it must be CSOM String.

From

When its value is undefined it must be CSOM 空引用(无 在 Visual Basic 中), otherwise it must be CSOM DateTime.

Until

When its value is undefined it must be CSOM 空引用(无 在 Visual Basic 中), otherwise it must be CSOM DateTime.

ContactInfo

When its value is undefined it must be CSOM 空引用(无 在 Visual Basic 中), otherwise it must be CSOM String.

示例

This code example adds an item to the Announcements list on the specified site.

using System;
using Microsoft.SharePoint.Client;

namespace Microsoft.SDK.SharePointFoundation.Samples
{
    class ListItemExample
    {
        static void Main()
        {
            string siteUrl = "http://MyServer/sites/MySiteCollection";

            ClientContext clientContext = new ClientContext(siteUrl);
            Web site = clientContext.Web;
            List targetList = site.Lists.GetByTitle("Announcements");

            ListItemCreationInformation itemCreateInfo = new ListItemCreationInformation();
            ListItem newListItem = targetList.AddItem(itemCreateInfo);
            newListItem["Title"] = "New Announcement";
            newListItem["Body"] = "Hello World!";
            newListItem.Update();

            clientContext.Load(newListItem);
            clientContext.ExecuteQuery();

            Console.WriteLine("Announcement created! \n\n"
               + "ID: " + newListItem.Id + "\nTitle: " + newListItem["Title"]);
        }
    }
}

线程安全性

该类型的任何公共 静态 (已共享 在 Visual Basic 中) 成员都是线程安全的。不保证任何实例成员都是线程安全的。

另请参阅

引用

ListItem 成员

Microsoft.SharePoint.Client 命名空间