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オブジェクトでは、次の方法があります。
メソッド |
説明 |
---|---|
Deletes the field from the list, from the site, or from the content types within the list. |
|
Sets the value of the ShowInDisplayForm property for this field. |
|
Sets the value of the ShowInEditForm property for this field. |
|
Sets the value of the ShowInNewForm property for this field. |
|
Commits changed properties of the field. |
|
Commits changed properties of the field and optionally propagates changes to all lists that use the field. |
|
Validates and parses the input value and updates the value of the list item. |
プロパティ
Fieldオブジェクトでは、次のプロパティがあります。
プロパティ |
説明 |
---|---|
Gets a value that specifies whether the field can be deleted. |
|
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. |
|
Gets or sets a value that specifies whether to require unique field values in a list or library column. |
|
Gets the name of the entity property for the list item entity that uses this field. |
|
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. |
|
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. |
|
Gets a value that specifies the field identifier. |
|
Gets or sets a Boolean value that specifies whether the field is indexed. |
|
Gets a value that specifies the field internal name. |
|
Gets or sets the name of an external JS file containing any client rendering logic for fields of this type. > [!NOTE] >JSLink プロパティは、アンケートの一覧またはイベントの一覧ではサポートされていません。SharePoint の予定表はイベントの一覧です。 |
|
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. |
|
Gets or sets a value that specifies the XML schema that defines the field. |
|
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. |
|
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. |
|
Gets or sets a value that specifies the type of the field. |
|
Gets a value that specifies the display name for the type of the field. |
|
Gets a value that specifies the description for the type of the field. |
|
Gets or sets a value that specifies the data validation criteria for the value of the field. |
|
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)