SP へフィールド オブジェクト (sp.js)

フォルダーに含まれているすべてのファイルのコレクションを取得します。

**適用対象:**apps for SharePoint | SharePoint Foundation 2013 | SharePoint Server 2013

var object = new SP.Field()

メンバー

Fieldオブジェクトでは、次のメンバーがあります。

Constructor

Fieldオブジェクトでは、次のコンスがあります。

コンストラクター

説明

フィールド

Initializes a new instance of the SP.Field object.

メソッド

Fieldオブジェクトでは、次の方法があります。

メソッド

説明

deleteObject

Deletes the field from the list, from the site, or from the content types within the list.

setShowInDisplayForm

Sets the value of the ShowInDisplayForm property for this field.

setShowInEditForm

Sets the value of the ShowInEditForm property for this field.

setShowInNewForm

Sets the value of the ShowInNewForm property for this field.

更新プログラム

Commits changed properties of the field.

updateAndPushChanges

Commits changed properties of the field and optionally propagates changes to all lists that use the field.

validateSetValue

Validates and parses the input value and updates the value of the list item.

プロパティ

Fieldオブジェクトでは、次のプロパティがあります。

プロパティ

説明

canBeDeleted

Gets a value that specifies whether the field can be deleted.

defaultValue

Gets or sets a value that specifies the default value for the field.

説明

Gets or sets a value that specifies the description of the field.

方向

Gets or sets a value that specifies the reading order of the field.

enforceUniqueValues

Gets or sets a value that specifies whether to require unique field values in a list or library column.

entityPropertyName

Gets the name of the entity property for the list item entity that uses this field.

fieldTypeKind

Gets or sets a value that specifies the type of the field.

フィルター処理

Gets a value that specifies whether list items in the list can be filtered by the field value.

fromBaseType

Gets a Boolean value that indicates whether the field derives from a base field type.

グループ

Gets or sets a value that specifies the field group.

非表示

Gets or sets a value that specifies whether the field is hidden in list views and list forms.

id

Gets a value that specifies the field identifier.

インデックス付き

Gets or sets a Boolean value that specifies whether the field is indexed.

internalName

Gets a value that specifies the field internal name.

jsLink

Gets or sets the name of an external JS file containing any client rendering logic for fields of this type.

> [!NOTE] >

JSLink プロパティは、アンケートの一覧またはイベントの一覧ではサポートされていません。SharePoint の予定表はイベントの一覧です。

readOnlyField

Gets or sets a value that specifies whether the value of the field is read-only.

必要な

Gets or sets a value that specifies whether the field requires a value.

schemaXml

Gets or sets a value that specifies the XML schema that defines the field.

schemaXmlWithResourceTokens

Gets the schema that defines the field and includes resource tokens.

範囲

Gets a value that specifies the server-relative URL of the list or the site to which the field belongs.

シール

Gets a value that specifies whether properties on the field cannot be changed and whether the field cannot be deleted.

ソート可能

Gets a value that specifies whether list items in the list can be sorted by the field value.

staticName

Gets or sets a value that specifies a customizable identifier of the field.

タイトル

Gets or sets value that specifies the display name of the field.

typeAsString

Gets or sets a value that specifies the type of the field.

typeDisplayName

Gets a value that specifies the display name for the type of the field.

typeShortDescription

Gets a value that specifies the description for the type of the field.

validationFormula

Gets or sets a value that specifies the data validation criteria for the value of the field.

validationMessage

Gets or sets a value that specifies the error message returned when data validation fails for the field.

次の例では、指定したフィールドを取得し、フィールドの説明を作成して、フィールドのタイトルと新しい説明を表示するアプリケーション] ページで、[入力] ボタンを作成します。

<asp:Content ID="Main" ContentPlaceHolderID="PlaceHolderMain" runat="server">
<script type="text/ecmascript" language="ecmascript">

    var fieldCollection;
    var oneField = null;
    function runCode() {
        var clientContext = SP.ClientContext.get_current();
        if (clientContext != undefined && clientContext != null) {
            var webSite = clientContext.get_web();
            taskList = webSite.get_lists().getByTitle("Tasks");

            fieldCollection = taskList.get_fields();
            this.oneField = fieldCollection.getByInternalNameOrTitle("Title");

            this.oneField.set_description("MyNewFieldDescription");
            this.oneField.update();

            clientContext.load(this.fieldCollection);
            clientContext.load(this.oneField);
            clientContext.executeQueryAsync(Function.createDelegate(this, this.OnLoadSuccess), Function.createDelegate(this, this.OnLoadFailed));
        }
    }

    function OnLoadSuccess(sender, args) {
        var fieldInfo = '';
        fieldInfo += 'Field Title: ' + oneField.get_title() + '\n' + 'Description: ' + oneField.get_description() + '\n';
        alert(fieldInfo);
    }

    function OnLoadFailed(sender, args) {
        alert('Request failed. ' + args.get_message() + '\n' + args.get_stackTrace());
    }
</script>

    <input id="Button1" type="button" value="Run Code" onclick="runCode()" />

</asp:Content>

他のリソースのエンドポイント

詳細については、フィールドのリソースを参照してください。

エンドポイント URI 構造

http://<sitecollection>/<site>/_api/web/lists(listid)/fields(fieldid)

HTTP 要求

このリソースには、次の HTTP コマンドがサポートしています。

書式を削除します。

DELETE http://<sitecollection>/<site>/_api/web/lists(listid)/fields(fieldid)

書式を結合します。

MERGE http://<sitecollection>/<site>/_api/web/lists(listid)/fields(fieldid)

投稿の書式

POST http://<sitecollection>/<site>/_api/web/lists(listid)/fields(fieldid)

書式を配置します。

PUT http://<sitecollection>/<site>/_api/web/lists(listid)/fields(fieldid)