
Uploading documents to a library
SharePoint lets you create new documents directly within the library through the Newmenu. It also lets you upload documents that have been authored offline.
In this recipe, we are going to learn how to upload an existing document to a document library and then tag it with the appropriate metadata. Even though this recipe uses the Marketing Collateral library as an example, the steps here are true for libraries of all types.
Getting ready
You will need Contributepermissions or higher for the library where you would like to upload the document.
How to do it...
To upload a document to your document library, follow these steps:
Browse to the library where you'd like to upload the document.
Click Upload and then choose the Files option to open the file selection dialog, as shown in the following screenshot:

Browse to the file that you'd like to upload and click the Open button.
SharePoint also supports drag and drop capabilities, which work with a wide variety of browsers. Simply drag and drop the files or folders anywhere in the browser window when viewing the library. This will result in SharePoint uploading the files or entire folders and any subfolders with the contents of these folders to the library, resulting in the same outcome as that of steps 2 and 3 here.
This will initiate the file upload process. SharePoint will show the newly uploaded file in the library, as shown in the following screenshot:

You will notice that SharePoint shows information about the file as well as a preview.
Before the document becomes visible to everyone, you will need to enter information in the required fields for this document. You will also want to give your file a friendly title at this point. Click on the Edit all link in the Properties pane for this document. Make sure the document is selected if you can't see the properties pane.
Enter or select the required information for the document and click the Save button, as shown in the following screenshot:

That's it! You have now uploaded your first document to a SharePoint document library. We will learn how to view and modify these documents in the Viewing and editing documents in the browser recipe in Chapter 5, Document Management in SharePoint Online.
How it works...
Documents are stored in libraries one document at a time. SharePoint also lets you upload or delete multiple documents at a time. If your documents have associated metadata, SharePoint lets you edit the metadata of multiple documents at once. The metadata that you add against the documents will also show up in the information panel in regular Office desktop apps or programs such as Microsoft Word, Excel, or PowerPoint. This can be seen in the following screenshot:

In addition to custom metadata, SharePoint will also store and show you additional information about who created or last modified the document and when. SharePoint also lets you create follow-up actions when documents are added, modified, or deleted. You can do this by using workflows in SharePoint or by using Microsoft Power Automate, which was added recently. For example, if a user uploads an expense report, you can send it through an automated approval process in your organization. Please refer to Chapter 13,Power Automate (Microsoft Flow), for more details.
Finally, SharePoint enforces some restrictions on file sizes and paths. You can view those restrictions here: https://m365book.page.link/File-Size-Path-Restrictions
Uploading a folder
You can upload an entire folder and any subfolders along with their entire contents to a SharePoint document library. To do so, simply browse to your library, click Upload, and choose the Folder option. You will then be prompted to select a folder from your computer. Selecting a folder will create a copy of that folder in the document library and copy all the contents of that local folder to the newly created folder in SharePoint online. Note that, as we mentioned earlier in this recipe, you can also simply drag and drop multiple folders into your document library view. Doing so will recreate the folders and their contents within the document library.