npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

spfx-rest-rvt

v6.0.0

Published

A TypeScript library for interacting with SharePoint REST APIs in SPFx projects

Readme

SharepointService - spfx-rest-rvt

A utility wrapper around SharePoint REST API for SPFx solutions using SPHttpClient.

Package: spfx-rest-rvt
Import Path: spfx-rest-rvt/dist

Features

  • Simplifies SharePoint REST API usage in SPFx
  • Supports item CRUD, file/folder operations, permissions, navigation, user profile, etc.
  • Handles large list pagination
  • CAML query support
  • Site and list provisioning utilities

📦 Installation

npm install spfx-rest-rvt

🚀 Usage

import { SharepointService } from "spfx-rest-rvt/dist";
import { WebPartContext } from "@microsoft/sp-webpart-base";

const spService = new SharepointService(context); // context is of type WebPartContext

// Get items from a list
spService.getListItems("Documents")
  .then(response => response.json())
  .then(data => {
    console.log("Items:", data.value);
  });
  

🔧 Constructor

new SharepointService(context: WebPartContext, siteUrl?: string);
  • context: SPFx WebPart context
  • siteUrl (optional): To target a different site than the current one

📘 API Overview

📄 List Item Methods

| Method | Description | |--------|-------------| | getListItems(listName, filter?) | Get items by list name | | getListItemsByListId(listId, filter?) | Get items by list ID | | getListItemsByListIdRecursive(listId, filter?) | Get all items (recursive) by list ID | | getListItemsByListTitleRecursive(listTitle, filter?) | Get all items (recursive) by list title | | getListItemsByListIdWithPagination(listId, top, skip) | Paginated items | | getListItemsByCamlQuery(listName, camlQuery) | Items using CAML | | getListItemById(listName, itemId, filter?) | Single item | | createOrUpdateListItem(listName, body, itemID?) | Create or update item | | UpdateListItem(listId, body, itemID) | Update item by list ID | | deleteListItem(listName, itemId) | Delete item |


📁 File & Folder Operations

| Method | Description | |--------|-------------| | uploadFile(folderPath, fileName, fileContent) | Upload file | | getAllFilesInFolder(folderUrl) | Get files in folder | | getFiles(libraryUrl) | Recursively get all files | | getFolders(libraryUrl) | Recursively get all folders | | getAllFoldersRecursively(libraryName) | Get all nested folders | | getFilesAndFolders(libraryUrl) | Get files + folders | | createFolder(libraryName, folderName) | Create folder | | updateFileMetadata(fileUrl, metadata) | Update metadata | | deleteFile(fileUrl) | Delete file |


📎 Attachment Operations

| Method | Description | |--------|-------------| | addAttachmentToListItem(listName, itemId, fileName, fileContent) | Add attachment | | deleteAttachmentFromListItem(listName, itemId, fileName) | Delete attachment |


🧾 List Metadata

| Method | Description | |--------|-------------| | getListColumns(listName, filter?) | Columns by name | | getListColumnsByListId(listId, filter?) | Columns by ID | | getDefaultViewFields(listId) | View fields | | getListViews(listName) | All views of list |


🏗 List and Site Management

| Method | Description | |--------|-------------| | getList(listName) | Get list info | | getLists() | All lists/libraries | | createList(listName, description) | Create list | | updateList(listName, body) | Update list | | deleteList(listName) | Delete list | | createSubsite(title, url, description, template) | Create subsite | | deleteSubsite(subsiteUrl) | Delete subsite | | getSiteCollection() | Get site collection details |


👥 User & Group Management

| Method | Description | |--------|-------------| | getUserDetails(email) | Get user by email | | getUserProfile() | Current user's profile | | getCurrentUser() | Current user object | | getSiteUsers() | All users in site | | getSiteGroups() | All site groups | | addUserToGroup(groupId, userLoginName) | Add user to group | | removeUserFromGroup(groupId, userId) | Remove user from group |


🔐 Permissions

| Method | Description | |--------|-------------| | getSitePermissions() | Role assignments & bindings | | addUserOrGroupToSitePermissions(principalId, roleDefId) | Add user/group to role | | removeUserOrGroupFromSitePermissions(principalId, roleDefId) | Remove user/group from role |


📚 Versioning

| Method | Description | |--------|-------------| | getVersionHistory(listId, itemId) | Get item versions | | restoreVersion(listId, itemId, versionId, fileName?) | Restore list item version | | restoreFileVersion(serverRelativeUrl, versionLabel) | Restore file version |


📂 Navigation

| Method | Description | |--------|-------------| | getSiteNavigation() | Quick launch navigation |


✅ Example

const spService = new SharepointService(context);

// Get items from a list
spService.getListItems("Documents")
  .then(response => response.json())
  .then(data => {
    console.log("Items:", data.value);
  });

// Upload file
const blob = new Blob(["Hello SharePoint!"], { type: "text/plain" });
spService.uploadFile("Shared Documents", "hello.txt", blob)
  .then(response => response.json())
  .then(data => {
    console.log("Uploaded:", data);
  });

📄 License

MIT


🙋‍♂️ Support

For bugs, issues, or contributions, please raise a GitHub issue or pull request.