Function
Static Public Summary | ||
public |
Adds an executeQuery function to the SP ClientContext that calls the executeQueryAsync function and returns a promise. |
|
public |
deleteItem(list: string, id: string): Promise<number> Deletes an item from a list. |
|
public |
fetchViewer(): Promise<Object> Get the currently logged in user. |
|
public |
getAvatarUrlByEmail(email: string): string |
|
public |
Fetches an item by id from list. |
|
public |
Fetches a list. |
|
public |
Save or update an item. |
|
public |
searchPerson(searchText: string, options: Object): Promise<Object[]> Search for persons in SP using clientPeoplePickerSearchUser. |
|
public |
shallowEqual(objA: *, objB: *): boolean |
Static Public
public addExecuteQuery() source
import addExecuteQuery from 'ntnu-react/util/sp/addExecuteQuery.js'
Adds an executeQuery function to the SP ClientContext that calls the executeQueryAsync function and returns a promise.
Example:
const ctx = window.SP.ClientContext.get_current();
const item = ctx.get_web().getList(list).getItemById(id);
addExecuteQuery();
ctx.executeQuery()
.then(() => {})
.catch(() => {});
public deleteItem(list: string, id: string): Promise<number> source
import deleteItem from 'ntnu-react/util/sp/deleteItem.js'
Deletes an item from a list.
public fetchViewer(): Promise<Object> source
import fetchViewer from 'ntnu-react/util/sp/fetchViewer.js'
Get the currently logged in user.
public getAvatarUrlByEmail(email: string): string source
import {getAvatarUrlByEmail} from 'ntnu-react/util/sp/index.js'
Params:
Name | Type | Attribute | Description |
string |
public getItem(list: string, id: string, options: Object): Promise<Object> source
import getItem from 'ntnu-react/util/sp/getItem.js'
Fetches an item by id from list.
Example:
getItem('List', '2', {
fields: [ 'Id', 'Title' ],
mapper: function(item) {
return {
id: item.get_id(),
title: item.get_item('Title')
};
}
})
.then((item) => {})
.catch((sender, args) => {});
public getList(list: string, options: Object): Promise<Object[]> source
import getList from 'ntnu-react/util/sp/getList.js'
Fetches a list.
Example:
getList('List', {
fields: [ 'Id', 'Title' ],
mapper: function(item) {
return {
id: item.get_id(),
title: item.get_item('Title')
};
}
})
.then((items) => {})
.catch((sender, args) => {});
public saveItem(list: string, item: Object, assigner: function(sp_item: Object)): Promise<Object> source
import saveItem from 'ntnu-react/util/sp/saveItem.js'
Save or update an item.
Example:
const obj = { id: 21, title: 'Mr.Beet' };
saveItem('List', obj, (item) => {
item.set_item('Id', obj.id);
item.set_item('Title', obj.title);
});
public searchPerson(searchText: string, options: Object): Promise<Object[]> source
import searchPerson from 'ntnu-react/util/sp/searchPerson.js'
Search for persons in SP using clientPeoplePickerSearchUser.
public shallowEqual(objA: *, objB: *): boolean source
import shallowEqual from 'ntnu-react/util/shallowEqual.js'
Params:
Name | Type | Attribute | Description |
objA | * | ||
objB | * |