Skip to main content



create(resource, data, callback)
get(path, query, callback)
getDrive(specifier, name, [callback])
getFile(pathOrId, options, [callback])
getFolder(pathOrId, options, [callback])
sheetToBuffer(rows, options)
uploadFile(resource, data, callback)


create(resource, data, callback) ⇒ Operation

Create some resource in msgraph

resourcestringThe type of entity that will be created
dataobjectThe data to create the new resource
callbackfunctionAn optional callback function


create("applications", {"displayName": "My App"})


get(path, query, callback) ⇒ Operation

Make a GET request to msgraph resource

pathstringPath to resource
queryobjectQuery, Headers and Authentication parameters
callbackfunction(Optional) Callback function




getDrive(specifier, name, [callback]) ⇒ Operation

Get a Drive or SharePoint document library. The drive metadata will be written to state.drives, where it can be used by other adaptor functions. Pass { id } to get a drive by id or { id, owner } to get default drive for some parent resource, like a group

specifierObjectA definition of the drive to retrieve - id {string} - The ID of the resource or owner. - owner {string} - The type of drive owner (e.g. sites, groups).
namestringThe local name of the drive used to write to state.drives, ie, state.drives[name]
[callback]functions => s(Optional) Callback function

Example (Get a drive by ID)

getDrive({ id: "YXzpkoLwR06bxC8tNdg71m" })

Example (Get the default drive for a site)

getDrive({ id: "", owner: "sites" })


getFile(pathOrId, options, [callback]) ⇒ Operation

Get file metadata or file content.

pathOrIdstringA path to a file or file id
optionsobject(Optional) Query parameters
[callback]functions => s(Optional) Callback function

Example (Get a file by ID)


Example (Get a file for a named drive by id)

getFile("01LUM6XOGRONYNTZ26DBBJPTN5IFTQPBIW",{ driveName: "mydrive"})


getFolder(pathOrId, options, [callback]) ⇒ Operation

Get the contents or metadata of a folder.

pathOrIdstringA path to a folder or folder id
optionsobject(Optional) Query parameters
[callback]functions => s(Optional) Callback function

Example (Get a folder by ID)


Example (Get a folder for a named drive by id)

getFolder("01LUM6XOCKDTZKQC7AVZF2VMHE2I3O6OY3",{ driveName: "mydrive"})


request ⇒

This is an asynchronous function that sends a request to a specified URL with optional parameters and headers, and returns the response data in JSON format.

Returns: The request function is returning the parsed JSON data from the response of the HTTP request made to the specified url with the given params and method. If there is an error in the response, the function will throw an error.

urlstringThe URL of the API endpoint that the request is being made to.
[options]objectAn object containing any additional parameters to be sent with the request, such as query parameters or request body data. It is an optional parameter and defaults to an empty object if not provided.


sheetToBuffer(rows, options) ⇒

The function sheetToBuffer takes in rows, options and optional callback, It creates a workbook and worksheet using the rows, appends the worksheet to the workbook, and returns the workbook as a buffer.

Returns: a buffer containing the Excel file in state.buffer.

rowsThe rows parameter is an array of objects representing the data to be written to the Excel sheet. Each object in the array represents a row in the sheet, and the keys of the object represent the column headers. The values of the object represent the data in each cell of the row.
optionsThe options parameter is an object that contains additional configuration options
[options.wsName]StringWorksheet name i.e 32 Characters
[options.bookType]StringFile format of the exported file, Default is 'xlsx'. See here for the function. It can have the following properties:

Example (Create a buffer containing excel file with `xlsx` output format )

sheetToBuffer('$.data[*]', {
wsName: 'Invalid Grant Codes',
bookType: 'xlsx',


uploadFile(resource, data, callback) ⇒ Operation

Upload a file to a drive

resourceObjectResource Object
[resource.driveId]StringDrive Id
[resource.driveId]StringSite Id
[resource.folderId]StringParent folder id
[resource.contentType]StringResource content-type
[resource.onConflict]StringSpecify conflict behavior if file with the same name exists. Can be "rename
dataObjectA buffer containing the file.
callbackfunctionOptional callback function

Example (Upload Excel file to a drive using `driveId` and `parantItemId`)

state => ({
driveId: state.driveId,
folderId: state.folderId,
fileName: `Tracker.xlsx`,
state => state.buffer

Example (Upload Excel file to a SharePoint drive using `siteId` and `parantItemId`)

state => ({
siteId: state.siteId,
folderId: state.folderId,
fileName: `Report.xlsx`,
state => state.buffer