viewpoint
v0.2.0
Published
the exchange email API for nodejs module
Downloads
4
Readme
node-viewpoint
the exchange API for nodejs module
Install
$ npm install --save viewpoint
Usage
var EWSClient = require('viewpoint');
var client = new EWSClient(username, password, ewsUrl, config);
client.syncFolders().then(function(res) {
console.log('sync folders successfully!');
});
More examples can refer to examples/
in the source repo.
API
Many API function return the Promise
object. For simplicity, I will use Promise(ObjectType)
to represent the Promise object that return the ObjectType
object. e.g. for function foo
that return Promise(Number)
, you can invoke it with
foo().then(number) {}
.
EWSClient
Methods
constructor:
function(username, password, url, options).
Constructor functiongetFolder:
function(folderId, opts).
Get the specific folder by folderIdfolderId:
String
orObject.
ThefolderId
can be like or {id: , changeKey: }. If you need distinguished id, then you should makefolderId
like {id: , type: 'distinguished'}return:
Promise(Folder).
TheFolder
object
getFolders:
function(folderIds, opts).
Get folders by folderIds arrayfolderIds
Array.
The array of folderId used to get a list of folderreturn:
Promise(Array).
Each item isFolder
.
findFolders:
function(opts).
Get the folders by theopts
- return:
Promise(RootFolder)
- return:
createFolders:
function(names, opts).
Create the folders by the names- return:
Promise(Array).
Each item isFolder
.
- return:
moveFolders:
function(folderIds, opts).
Move the folders that the id is in thefolderIds
.- return:
Promise(Array).
Each item isFolder
.
- return:
syncFolders:
function(opts).
Synchronize the foldersopts:
Object.
syncState:
String.
It represent the folders synchronization state.folderShape:
Object.
The option represent what to return from server. It can like{baseShape: 'Default', additionalProperties: 'item:ParentFolderId'
.
return:
Promise(EWSSyncResponse).
syncFoldersWithParent:
function(syncState).
Synchronize the folders just likesyncFolders
but also theparentFolderId
variable will return.- return:
Promise(EWSSyncResponse).
- return:
getItem:
function(itemId, opts).
Get the message by theitemId
.itemId:
String
orObject.
The item id is like{id: <id>}
or<id>
.return:
Promise(Item)
orPromise(Message)
.
getItems:
function(itemIds).
Get the messages by itemIds.itemIds:
Array.
Each item isString
orObject
.return:
Promise(Array).
Each item isMessage
.
findItems:
function(opts).
Get the information of items that match the opts.deleteItems:
function(items).
Delete the specific items.moveItems:
function(items, folder).
Move the items to the destination folder.- folder:
String
orObject.
The destination folder id.
- folder:
copyItems:
function(items, folder).
Copy the items to the destination folder.saveItems:
function(opts).
Save items in the specific folder.sendItems:
function(opts).
Send items to destination mailbox.sendAndSaveItems:
function(opts).
Send items to destination mailbox and save to the specific folder.markRead:
function(items).
Mark the items to have read.- items:
Array
orObject
. The Array of itemid or itemid.
- items:
Folder
Methods
totalCount:
function().
The total count of items- return:
Number
- return:
childFolderCount:
function().
The count of child folders- return:
Number
- return:
unreadCount:
function().
The count of unread items- return:
Number
- return:
folderClass:
function().
The folder class such as 'IPF'- return:
String
- return:
displayName:
function().
The display name- return:
String
- return:
folderId:
function().
Get folder id object- return:
Object
- return:
parentFolderId:
function().
Get parent folder id object- return:
Object
- return:
RootFolder
Methods
totalItemsInView:
function().
Get the count of return items.- return:
Number.
- return:
includesLastItemInRange:
function().
Get whether or not the last item is included.- return:
Bool
- return:
items:
function().
Get the items of folder.- return:
Array.
TheArray
ofMessage
.
- return:
folders:
function().
Get the child folders of this folder.- return:
Array.
TheArray
ofFolder
.
- return:
EWSSyncResponse
Methods
syncState:
function().
Get the current synchronization state.- return:
String.
- return:
includesLastItemInRange:
function().
Get whether the items include the last item.- return:
Bool
- return:
creates:
function().
Get the created items.- return:
Array.
Each item isMessage
.
- return:
updates:
function().
Get the updated items.- return:
Array.
Each item isMessage
.
- return:
deletes:
function().
Get the deleted items.- return:
Array.
Each item isMessage
that be deleted.
- return:
Contributing
In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using gulp.
License
Copyright (c) 2015 liuxiong. Licensed under the MIT license.