How to Create Custom Web Parts in SharePoint Online
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.

- 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.
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.
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.
Install Node.js, a code editor like Visual Studio Code, and the Yeoman SharePoint generator via your command line interface.
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.
Write your custom logic and UI using TypeScript and your preferred front-end framework, such as React, directly within the generated project structure.
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.
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.

Seek Assistance on the Microsoft Q&A Platform
Connect with Microsoft specialists to resolve specific development roadblocks or deployment errors in SharePoint Online.
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. Download the software: Visit the official WPS Office website and download the free installer for your operating system.
- 2. Install WPS Office: Run the setup wizard to complete the quick installation process.
- 3. Open your Microsoft Office files: Launch WPS Office and directly open your existing .docx, .xlsx, or .pptx files with full formatting preservation.

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.




