
Adding an item to a list
You can add items to a list in various ways. These methods will be covered in greater detail in Chapter 4, Working with Lists and Libraries in SharePoint Online. This recipe will show the most commonly used method to add items to the representative list we created as part of the previous recipe. Even though this recipe uses theProduct Listas an example, the steps here are true for other scenarios where there's a need to store data in SharePoint.
Getting ready
You will need Contribute permissions or higher for the list you would like to add the new item to.
How to do it...
To add a new item to a list, follow these steps:
Browse to the list where you'd like to add the new item.
Click the New button above the section that shows the title of the list.
Enter information for the required fields (highlighted by a red *) and, optionally, the non-required fields, as shown in the following screenshot:

You can also optionally add file attachments for this item by clicking the Add attachments hyperlink toward the bottom of the form. File attachments include a variety of file types – images and documents, to name a few.
Click the Save button to add the item to the list.
Congratulations! You just added a new item to a SharePoint list.
How it works...
Information in lists is stored one item at a time (although there are ways to work with multiple items at a time). You can imagine a list item as a single row in an Excel spreadsheet, except that this row can hold a variety of rich information. Each list comes with a set of forms to add, edit, and view these items. Each list item can optionally also contain one or more attachments. Furthermore, the add, edit, and view forms can be customized to meet specific user needs. Every time an item is added or edited in a list, SharePoint also stores additional information (or metadata) against that item. This metadata includes information such as who created and/or edited the item and when. SharePoint also lets you create follow-up actions when items are added or updated in a list. You can do this using Power Automate, which we will discuss in depth in Chapter 13, Power Automate (Microsoft Flow).
There's more...
Provided you have appropriate access, you can also delete one or more list items from a list and documents from a library. Let's learn how to do that here.
Deleting an item
To delete a list item, simply browse to your list, select the file you would like to delete, and then click the Delete option from the list's menu bar, as shown in the following screenshot:

Alternatively, you can also right-click the list item or click the three dots to the right of the title field to open the context menu and then click Delete to delete the item. This is shown in the following screenshot:

Deleting an item from a list or library sends it to the recycle bin, where it stays there for a couple of days until it gets moved to the second stage recycle bin or until it gets permanently deleted. You can restore deleted items as long as they are still in the recycle bin and have not been permanently deleted. Please refer to the Viewing site contents recipe, earlier in this chapter, to read more about the site recycle bin.
Additionally, if you look closely at the preceding screenshot, you will notice that the various list item-related actions in the menu bar of the list are also available through the context menu. The context menu also shows quite a few other actions that you can perform on the selected list item. This is also true for the context menu that appears against the files or documents in SharePoint libraries. Please note that the steps provided here for deleting list items are also true for deleting files from SharePoint libraries.