1.0.0 • Published 8 years ago
sp-view-fields v1.0.0
sp-view-fields
Get view fields by SharePoint list view.
Installation
npm install sp-view-fields --save
Usage
JavaScript
import { getViewFields } from 'sp-view-fields';
var options = {
webUrl: 'web url',
isAppContextSite: false,
list: 'id or title',
view: 'id or title'
};
getViewFields(options, function (viewFields) {
// Now you have an array of SP.Field
}, function (errorMessage) {
// Error
});
TypeScript
typings install dt~microsoft.ajax --global --save
typings install dt~sharepoint --global --save
/// <reference path='./typings/index.d.ts'/>
import { getViewFields, IViewFieldsOption } from 'sp-view-fields';
let options: IViewFieldsOption = {
webUrl: 'web url',
isAppContextSite: false,
list: 'id or title',
view: 'id or title'
};
getViewFields(options, function (viewFields: Array<SP.Field>) {
// Now you have an array of SP.Field
}, function (message: string) {
// Error
});
Test
cd sp-view-fields/test/Scripts/src
npm install
webpack
API
interface IViewFieldsOption {
webUrl: string;
isAppContextSite: boolean;
list: string;
view: string;
}
interface IViewFieldsOnSuccess {
(viewFields: Array<SP.Field>): void;
}
interface IViewFieldsOnError {
(message: string): void;
}
function getViewFields(options: IViewFieldsOption, success: IViewFieldsOnSuccess, error: IViewFieldsOnError): void;
License
MIT.