Methods
(
source code)
Find an user based on a part of his name
Parameters:
String
word Optional
A part of the name from the guy you're looking for
Object
setup Optional
Options (see below)
String
setup.limit Optional, Default: 10
Number of results returned
String
setup.type Optional, Default: 'User'
String
setup.url Optional, Default: 'current website'
The website url
Returns:
Promise
resolve([{AccountName,UserInfoID,DisplayName,Email,Departement,Title,PrincipalType}]), reject(error)
Example:
$SP().addressbook("john", {limit:25}).then(function(people) {
for (var i=0; i < people.length; i++) {
for (var j=0; j < people[i].length; j++) console.log(people[i][j]+" = "+people[i][people[i][j]]);
}
});
(
source code)
distributionLists(username, setup)
Find the distribution lists where the specified user is member of
Parameters:
String
username
The username with or without the domain ("domain\\login" for Sharepoint 2010, or e.g. "i:0#.w|domain\\login" for Sharepoint 2013)
Object
setup Optional
Options (see below)
String
setup.url Optional, Default: 'current website'
The website url
Boolean
setup.cache Optional, Default: true
Cache the response from the server
Returns:
Promise
resolve(mailings), reject(error)
Example:
$SP().distributionLists("mydomain\\john_doe",{url:"http://my.si.te/subdir/"}).then(function(mailing) {
for (var i=0; i < mailing.length; i++) console.log(mailing[i]); // -> {SourceReference: "cn=listname,ou=distribution lists,ou=rainbow,dc=com", DisplayName:"listname", MailNickname:"List Name", Url:"mailto:listname@rainbow.com"}
});
(
source code)
getUserInfo(username, setup)
Find the User ID, work email, and preferred name for the specified username (this is useful because of the User ID that can then be used for filtering a list)
Parameters:
String
username
That must be "domain\\login" for Sharepoint 2010, or something like "i:0#.w|domain\\login" for Sharepoint 2013
Object
setup Optional
Options (see below)
String
setup.url Optional, Default: 'current website'
The website url
Returns:
Promise
resolve({ID,Sid,Name,LoginName,Email,Notes,IsSiteAdmin,IsDomainGroup,Flags}), reject(error)
Example:
$SP().getUserInfo("domain\\john_doe",{url:"http://my.si.te/subdir/"}).then(function(info) {
alert("User ID = "+info.ID)
}, function(error) {
console.log(error)
});
(
source code)
groupMembers(groupname, setup)
Find the members of a Sharepoint group
Parameters:
String
groupname
Name of the group
Object
setup Optional
Options (see below)
String
setup.url Optional, Default: 'current website'
The website url
Boolean
setup.cache Optional, Default: true
By default the function will cache the group members (so if you call several times it will use the cache)
Returns:
Promise
resolve(members), reject(error)
Example:
$SP().groupMembers("my group").then(function(members) {
for (var i=0; i < members.length; i++) console.log(members[i]); // -> {ID:"1234", Name:"Doe, John", LoginName:"mydomain\john_doe", Email:"john_doe@rainbow.com"}
});
(
source code)
Find if the user is member of the Sharepoint group
Parameters:
Object
setup Optional
Options (see below)
String
setup.user
Username with domain ("domain\\login" for Sharepoint 2010, or e.g. "i:0#.w|domain\\login" for Sharepoint 2013)
String
setup.group
Name of the group
String
setup.url Optional, Default: 'current website'
The website url
Boolean
setup.cache Optional, Default: true
Cache the response from the server
Returns:
PRomise
resolve(isMember), reject(error)
Example:
$SP().isMember({user:"mydomain\\john_doe",group:"my group",url:"http://my.site.com/"}).then(function(isMember) {
if (isMember) alert("OK !")
});
(
source code)
Find the user details like manager, email, ...
Parameters:
String
username Optional
With or without the domain, and you can also use an email address, and if you leave it empty it's the current user by default (if you use the domain, don't forget to use a double \ like "mydomain\\john_doe")
Object
setup Optional
Options (see below)
String
setup.url Optional, Default: 'current website'
The website url
Returns:
function
resolve(people), reject(error)
Example:
$SP().people("john_doe",{url:"http://my.si.te/subdir/"}).then(function(people) {
for (var i=0; i < people.length; i++) console.log(people[i]+" = "+people[people[i]]);
}, function(err) {
console.log("Err => ",err)
});
(
source code)
usergroups(username, setup)
Find the Sharepoint groups where the specified user is member of
Parameters:
String
username
The username with the domain ("domain\\login" for Sharepoint 2010, or e.g. "i:0#.w|domain\\login" for Sharepoint 2013)
Object
setup Optional
Options (see below)
String
setup.url Optional, Default: 'current website'
The website url
Boolean
setup.cache Optional, Default: true
Keep a cache of the result
Returns:
Promise
result(groups), reject(error)
Example:
$SP().usergroups("mydomain\\john_doe",{url:"http://my.si.te/subdir/"}).then(function(groups) {
for (var i=0; i < groups.length; i++) console.log(groups[i]); // -> "Roadmap Admin", "Global Viewers", ...
});
(
source code)
Find the current user's details like manager, email, colleagues, ...
Parameters:
Object
setup Optional
Options (see below)
String
setup.url Optional, Default: 'current website'
The website url
Returns:
Promise
} resolve(people), reject(error)
Example:
$SP().whoami({url:"http://my.si.te/subdir/"}).then(function(people) {
for (var i=0; i < people.length; i++) console.log(people[i]+" = "+people[people[i]]);
});