Часто возникает необходимость установить свойства видимости полей списка.
Для SharePoint on-premise можно использовать SharePoint manager.
Для SharePoint online можно использовать Chrome dev tools (F12) и JavaScript
- function setFieldVisibility(listTitle,fieldName,properties,success,failure)
- {
- var ctx = SP.ClientContext.get_current();
- var web = ctx.get_web();
- var list = web.get_lists().getByTitle(listTitle);
- var field = list.get_fields().getByTitle(fieldName);
- field.setShowInDisplayForm(properties.ShowInDisplayForm);
- field.setShowInNewForm(properties.ShowInNewForm);
- field.setShowInEditForm(properties.ShowInEditForm);
- field.set_hidden(properties.Hidden);
- field.update();
- ctx.executeQueryAsync(success,failure);
- }
- var listTitle = 'Custom List';
- var fieldName = 'Title';
- var properties = {
- 'ShowInDisplayForm': false,
- 'ShowInNewForm': false,
- 'ShowInEditForm': false,
- 'Hidden': true
- };
- setFieldVisibility(listTitle,fieldName,properties,
- function () {
- console.log("Field visibility settings has been changed");
- },
- function(sender,args){
- console.log(args.get_message());
- }
- );