logo
search
Others

How to Create Custom Web Parts in SharePoint Online

Partner EditorPartner Editor Sep 27, 2026 869 views

Question details

The user needs to develop custom web parts for SharePoint Online in Microsoft 365, but finds that Visual Studio only provides templates for SharePoint 2016 and 2019.

How to Create Custom Web Parts in SharePoint Online
Product
SharePoint Online
Device & OS
not provided
Scenario
Setting up a development environment to build and deploy custom web parts specifically for a Microsoft 365 SharePoint Online tenant.
Observed behavior
Visual Studio templates default to on-premises server solutions (SharePoint 2019/2016), lacking direct options for modern SharePoint Online client-side web part deployment.
Before you start

Ensure you have a Microsoft 365 developer tenant set up and Node.js installed on your computer, as modern SharePoint Online development relies on client-side tools rather than traditional Visual Studio server-side templates.

Solution 1Recommended

Build Client-Side Web Parts using the SharePoint Framework (SPFx)

Transition from traditional Visual Studio farm solutions to the SharePoint Framework (SPFx) to build modern client-side web parts for SharePoint Online.

SharePoint Online development has shifted away from server-side solutions (like those used in SharePoint 2016/2019) to client-side development. The SharePoint Framework (SPFx) is the recommended model for creating modern, responsive web parts in Microsoft 365 using web technologies and tools.

1
Set up your development environment

Install Node.js, a code editor like Visual Studio Code, and the Yeoman SharePoint generator via your command line interface.

2
Scaffold your web part project

Open your terminal, create a new project directory, and run the command 'yo @microsoft/sharepoint' to generate the boilerplate code for your new client-side web part.

3
Develop the web part

Write your custom logic and UI using TypeScript and your preferred front-end framework, such as React, directly within the generated project structure.

4
Test locally in the Workbench

Run 'gulp serve' in your terminal to preview and test your custom web part on the local SharePoint Workbench without needing to deploy it first.

5
Package and deploy

Bundle your solution using 'gulp bundle --ship' and package it with 'gulp package-solution --ship'. Finally, upload the generated .sppkg file to your SharePoint Online App Catalog.

Build Client-Side Web Parts using the SharePoint Framework (SPFx)
Microsoft Documentation: Follow Microsoft's official guide on 'Building your first SharePoint client-side web part' for complete command-line prerequisites and detailed coding examples.
Free Microsoft Office alternative

Discover WPS Office for Your Daily Documentation Needs

While building SharePoint web parts requires specialized Microsoft 365 developer tools, you don't have to rely on expensive subscriptions for your general office tasks. WPS Office is a highly compatible, lightweight, and free alternative, perfect for drafting project documentation, managing development spreadsheets, and designing presentations.

  1. 1. Download the software: Visit the official WPS Office website and download the free installer for your operating system.
  2. 2. Install WPS Office: Run the setup wizard to complete the quick installation process.
  3. 3. Open your Microsoft Office files: Launch WPS Office and directly open your existing .docx, .xlsx, or .pptx files with full formatting preservation.
Completely free to use with a lightweight, fast installationFully compatible with Microsoft Word, Excel, and PowerPoint formats (.docx, .xlsx, .pptx)Includes a rich set of templates for software project documentation and reportingFamiliar user interface ensuring a seamless transition from Microsoft Office
microsoft office alternative - wps office

Frequently Asked Questions

Why doesn't Visual Studio show SharePoint Online templates?

Traditional Visual Studio SharePoint templates are designed for server-side farm solutions used in on-premises versions like SharePoint 2016 and 2019. SharePoint Online relies on the modern, client-side SharePoint Framework (SPFx), which is typically scaffolded using command-line tools like Node.js and Yeoman rather than Visual Studio GUI templates.

What programming languages are required to build SharePoint Online web parts?

Modern SharePoint Online web parts built via the SharePoint Framework (SPFx) are primarily developed using TypeScript, HTML, and CSS. Developers also frequently utilize modern front-end JavaScript frameworks such as React.

Where can I test my custom SharePoint web part before deploying it?

You can test your custom web parts locally using the SharePoint Workbench, which is included in the SPFx development toolchain. It provides a local testing environment in your browser so you can preview changes instantly without uploading files to your live Microsoft 365 tenant.