In this post, I’ll show how you can both delete and restore SharePoint Online sites.
Note: You must be a SharePoint administrator or a SharePoint site owner to be able to delete a site, and only SharePoint administrators can restore them.
How to delete a SharePoint site
If you’re a site owner, follow these steps to delete your site:
Click the settings wheel in the upper right corner
Select Site information
Select Delete site
Check the confirmation box and then click Delete
If you’re a SharePoint administrator, you can follow these steps to delete a site:
Go to the SharePoint admin center (app launcher > Admin > SharePoint)
Select Sites > Active sites from the left navigation menu
Search or browse and select the site to delete
Select Delete from the top ribbon menu
Select Delete again in the dialog prompt
A video demonstration of both of these methods is below:
How to restore a SharePoint site
Deleted sites can only be restored within the first 93 days since its deletion. Otherwise, after 93 days, the site is permanently deleted.
Here are the steps a SharePoint admin can follow to restore a previously deleted site:
Go to the SharePoint admin center
Select Sites > Deleted sites from the left-hand navigation menu
Select the specific site to restore
Select Restore from the top ribbon menu
A video demonstration of these steps can be found below:
If you’re trying to build business process flows, use Process Advisor, or use AI Builder in Power Automate, you’re going to need a database established in the intended environment first. If you don’t have a database in the environment yet, you’ll get an error as seen below:
Business process flow requires a Microsoft Dataverse database. Try a different environment or create a new one to start using business process flow.
You need a database to use process advisor. Create a database, or switch to an environment that has one.
AI Builder requires a Dataverse database. Create your database to start using AI models.
In the following sections, I’ll detail how to:
Switch to a different environment
Add a database to your current (or any) environment
Create a new environment with a database
Switch to a different environment
Your organization could already have multiple environments. Always check with your admins before making any uncertain decisions because environments could be used for specific data types, processes, geography compliance restrictions, etc. You may or may not have access to all of your organization’s environments depending on your specific organization’s governance and configuration.
Let’s assume you do have multiple environments and you’ve discussed with your admin or governance team which environments are appropriate for your specific need or project. To switch to a different environment that might have a usable database, click on the name of your current environment in Power Automate in the upper right, then choose the other environment from the side panel.
Click to enlarge
Add a database to your environment
You may choose to just stay in your current environment and add a database to it. If that’s the case, go ahead and click on Create a database and follow the right side panel’s wizard to complete the process.
Let’s assume your organization hasn’t yet created any additional environments you could use other than the default one that came with your tenant (which obviously doesn’t have a database or you wouldn’t be here 😄). If you don’t want to create the database in the default environment, you may wish to create a new environment with a new database.
Check out this other post for help in creating a new environment that includes a Dataverse database.
Did you run out of capacity in your Dataverse environments from Power Automate and Power Apps usage? You have several options, and I’ll cover four in this post:
Change the environment type from Production to Trial. This will allow you to proceed with provisioning the environment for your trial purposes. You can later convert this to Production, but only if you have more database capacity when you’re ready to do so.
Click to enlarge – change the environment type from Production to Trial when creating a new environment as a user.
As a global admin, go to the Microsoft 365 admin center (https://admin.microsoft.com). Then choose Billing > Purchase services from the left nav.
In the search bar, search for capacity and choose the type of capacity you’d like to add for your organization (i.e. Power Apps portals page views, AI Builder, etc.).
Click to enlarge
Choose Details for the capacity type you’re seeking to expand and complete your purchase.
Click to enlarge
You should also be sure to check out these two resources once you’ve completed your purchase:
Just trying to clean up a bit? Start your evaluation by going to the Power Platform admin center’s Capacity page to see what’s using up the most space. Are there things you could clean up? Notice any unusual usage?
Click to enlarge
Depending on what you find in the Capacity page, you may find yourself wanting to look more closely at environments. To do this, select the Environments node from the left-hand nav.
From Environments, you can select an environment and choose to view its resources which will give you a good idea of what might be using more than anticipated. Perhaps a flow or app just needs adjusted. You could, for example, open a listed environment and choose Resources > Flows, examine the flows using the environment, see their owners, and even disable the flows until further action can be taken to address the underlying issue.
Delete an environment
See any environments that could be deleted? Just keep in mind a deleted environment takes its resources and backups too – so consider any flows, apps, etc. that might need updated to use a different environment first.
If you do determine there are unused and unneeded environments in your organization, you can delete them from the Power Platform admin center.
Note: This post applies to traditional environments, not Dataverse for Teams environments. Thanks to Loryan Strant for adding that clarification.
As long as someone in your organization is on a Power Apps or Power Automate per-user plan, they may have permission to create their own environment (unless you’ve already limited it previously in your organization). These environments can be used and shared by Dynamics 365, Power Apps portals and apps, and Power Automate flows. Environments can house multiple Dataverse tables (which can also be provisioned by a power user with appropriate licensing). Power Platform apps and Dynamics 365 can then connect to, read from, and write to these tables which would likely be shared across multiple applications/processes.
For example, if Megan Bowen is licensed on a Power Apps per-user plan she would, by default, be able to create new environments as she wished. And with the right training and deployed best practices, this may not be an issue. But if training isn’t provided and users are creating environments left and right, it may be time to limit who can create them (regardless of their licensing) until proper training and governance can be deployed.
So if you wish to manage environments centrally and prevent environment sprawl, you will want to limit the ability of users in your organization so they can’t create their own environments. Doing this may slow their individual productivity, but could also prevent duplicated efforts, inconsistent data organizationally, scattered naming conventions, and more. As long as you replace this restriction with a formal and effective governance policy, request form, etc. it will minimize disruption to your colleagues’ productivity.
Ready to do this? Let’s go over the steps to limit Microsoft Power Platform environment creation and management.
Limit new environment creation via the Power Platform admin center
Choose the Settings gear in the upper right corner and choose Power Platform settings.
Click to enlarge
Then change Who can create production and sandbox environments to Only specific admins. As seen in the tooltip in the following screenshot, this limits creation to:
Note that this doesn’t remove existing environments or limit the abilities of their creator(s) to continue managing pre-existing environments. This setting will only apply to new environments and prevent additional unwanted sprawl.
Without an App Catalog and a setting enabled, your users may run into the following error when attempting to access the SharePoint Store from the “Add an app” dialog:
“Sorry, apps are turned off. If you know who runs the server, tell them to enable apps.”
If you’ve run into this issue and are a farm admin, you can enable the app store and ability in SharePoint 2019 by following these steps. If you’ve already created the App Catalog site collection, skip to step 4.
1. Log onto your central admin server and open central admin
Click to enlarge
2. Choose Apps > Manage App Catalog. Make sure the Web Application shown is the correct web application then click OK to create a new App Catalog (or enter a URL for one if you’ve already created one)
Click to enlarge
3. Set the App Catalog site name and description, URL, admin, and then end users who should see apps in the catalog.
Click to enlarge
4. Once you have an App Catalog, go back to Apps > Configure store settings.
Click to enlarge
5. Confirm the Web Application shown is the correct web app, then change App Purchases to Yes. Save your changes.
Now when users who were granted access to view apps in the store choose SharePoint Store from the “Add an app” dialog, they’ll be able to get marketplace apps as well.
I wanted to get an idea of how many people were using discussion boards in my SharePoint Server environment and in what sites. I modified a script I found to create the sort of inventory list I needed and ended with a script that:
Provides a list within PowerShell of each URL, site name, and list name found matching a specific list type.
Provides a total count and save location confirmation at the end.
Exports a CSV file of the details to a specified location.
Find the Template ID for the list you’re searching for
List template ID options are as follows, taken from this Docs article. You’ll need the Template ID of the type of list you wish to search in your SharePoint environment.
List template type
Template ID
Base type
Description
Custom List
100
0
A basic list that can be adapted for multiple purposes.
Document Library
101
1
Contains a list of documents and other files.
Survey
102
4
Fields (2) on a survey list represent questions that are asked of survey participants. Items in a list represent a set of responses to a survey.
Links
103
0
Contains a list of hyperlinks and their descriptions.
Announcements
104
0
Contains a set of simple announcements.
Contacts
105
0
Contains a list of contacts used for tracking people in a site (2).
Calendar
106
0
Contains a list of single and recurring events. An events list has special views for displaying events on a calendar.
Tasks
107
0
Contains a list of items that represent finished and pending work items.
Discussion Board
108
0
Contains discussions entries and their replies.
Picture Library
109
1
Contains a library adapted for storing and viewing digital pictures.
DataSources
110
1
Contains data connection description files.
Form Library
115
1
Contains XML documents. An XML form library can also contain templates for displaying and editing XML files through forms, as well as rules for specifying how XML data is converted to and from list items.
No Code Workflows
117
1
Contains additional workflow definitions that describe new processes that can be used in lists. These workflow definitions do not contain advanced code-based extensions.
Custom Workflow Process
118
0
Contains a list used to support custom workflow process actions.
Wiki Page Library
119
1
Contains a set of editable Web pages.
CustomGrid
120
0
Contains a set of list items with a grid-editing view.
No Code Public Workflows
122
1
A gallery for storing workflow definitions that do not contain advanced code-based extensions.
Workflow History
140
0
Contains a set of history items for instances of workflows.
Project Tasks
150
0
Contains a list of tasks with specialized views of task data in the form of Gantt chart.
Public Workflows External List
600
0
An external list for viewing the data of an external content type.
Now your report will include all list types, and an added column to specify that list type. Note that this will take a while to run in larger environments.
You could also modify the script to only display in PowerShell (delete lines 23-25 and 31-33) or only export to CSV (delete lines 19-22 and 31-33) but I wanted both outputs for my purposes.
Idea: Take it further with Power BI
Take this to the next level by automating the PowerShell script to run on a schedule exporting results to a folder Power BI reads on an automatic refresh. This is an easy way to get a hands-off dashboard of SharePoint usage by list type.
I’m often asked for a way to modify permissions beyond what’s available out of the box, but without using workflows.
There are settings that allow item-level permissions in lists (List Settings > Advanced Settings > Item-level Permissions) so that users can only see and/or edit their own items, but this may not solve your need. If so, ta-da! If not, keep reading.
Click to enlarge
In this post, I’ll cover one solution in which we create a custom permission level at the site level that we’ll assign to a group on a specific list’s permissions. This new, custom permission level will be the same as the Contribute level (out of the box) but removes the ability for users to delete items or versions.
Creating a custom permission level involves a couple main steps:
Create the new permission level.
Change permissions on the list so that the group of users who should have the new permission level are assigned the new permission level.
Create the new, custom permission level
1. Go to Site Settings
2. Under Users and Permissions, select Site permissions
3. Click Permission Levels
4. You could click Add a Permission Level but I typically prefer to copy an existing level (like Contribute) and just make a couple small changes. For this tutorial, I’m going to select Contribute.
Click to enlarge
If copying a level, scroll down to the bottom after selecting a level and click Copy Permission Level.
5. Name and describe the new permission level, then check and uncheck as needed to create the permission level desired. In my example, I want to copy Contribute, but remove the delete ability so I’ve unchecked the two options involving deletion of items and versions.
Click to enlarge
6. Scroll down and click Create.
Change permissions on the list
Now we need to assign our new permission level to users on the list for which we’re preventing deletion.
1. Go to List Settings.
2. Under Permissions and Management, select Permissions for this list.
3. Select the box next to the name of the group for which you’re modifying permissions.
4. Click Edit User Permissions from the top ribbon menu.
5. Uncheck the current permission level assigned to the group, and check the new custom permission level.
Perhaps you’ve changed SharePoint administrators or a site owner or two recently. Where are the SharePoint site Access Requests they were receiving now going?
This post covers two PowerShell methods of updating the email address used across all sites in bulk:
Replace the email address used on ALL sites, no exceptions (reset all requests throughout the web app to be sent to one address)
Change all instances of a specific address to a replacement across ALL sites (i.e. replace the former site owner’s address used in 12 sites’ Access Request Settings with the new site owner’s address)
The second method is particularly nice because it eliminates any guesswork involved in wondering where the former admin/owner may have been listed as the recipient.
Replace the email address used on ALL sites
To modify the email address used for all SharePoint sites and subsites in a web app, run the PowerShell script below from a SharePoint server. You’ll need to replace the $webapp and $requestemail values at the top.
Caution: This action cannot be undone. It replaces the Access Request email on all sites and subsites.
Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue
$webapp = Get-SPWebApplication https://sharepoint.contoso.com
$requestemail = "new-request-recipient@demo.com"
foreach($site in $webapp.Sites)
{
foreach($web in $site.AllWebs)
{
$url = $web.url
Write-host "Checking "$url
if (!$web.HasUniquePerm)
{
Write-Host "Site inherits Access Request settings from parent." -ForegroundColor Yellow
}
else
{
if($web.RequestAccessEnabled)
{
Write-Host "Site utilizes Access Requests."
$web.RequestAccessEmail = $requestemail
$web.Update()
Write-Host "Email changed to " $requestemail -ForegroundColor Green
}
else
{
Write-Host "Site is not utilizing Access Requests." -ForegroundColor Yellow
}
} }
}
Replace all instances of a specific user across all sites in the web app
Perhaps a particular individual left their site owner/admin role and you just want to replace any instance of THAT user in Access Request settings throughout the web app. In that case use the following script instead (updating the three parameters at the top, $webapp, $oldrequestemail, and $newrequestemail):
Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue
$webapp = Get-SPWebApplication https://sharepoint.contoso.com
$oldrequestemail = "old-request-email@contoso.com"
$newrequestemail = "new-request-email@contoso.com"
foreach($site in $webapp.Sites)
{
foreach($web in $site.AllWebs)
{
$url = $web.url
Write-host "Checking "$url
if (!$web.HasUniquePerm)
{
Write-Host "Site inherits Access Request settings from parent." -ForegroundColor Yellow
}
else
{
if($web.RequestAccessEnabled)
{
if($web.RequestAccessEmail -eq $oldrequestemail)
{
Write-Host "Site utilizes Access Requests sent to old email ("$web.RequestAccessEmail")." -ForegroundColor Red
$web.RequestAccessEmail = $newrequestemail
$web.Update()
Write-Host "Email changed to" $newrequestemail -ForegroundColor Green
}
else
{
Write-Host "Email ("$web.RequestAccessEmail") does not match old email address. No change made." -ForegroundColor Yellow
}}
else
{
Write-Host "Site is not utilizing Access Requests." -ForegroundColor Yellow
}
}
}
}
Note: If you’ve changed the Access Request recipient and the new person is receiving a “Sorry, this site hasn’t been shared with you” error when attempting to approve requests, check out this post for help.
Those of you with Office 365/SharePoint Online have a simple path to disabling modern page commenting via the admin center. But for those of you, like myself, who also work in SharePoint 2019, your method involves PowerShell and is a bit more laborious. In this post, I’ll cover both methods: Disabling comments via PowerShell for SharePoint 2019 (server) and then via the admin center for SharePoint Online (O365).
Firstly, why disallow commenting altogether instead of giving site owners and page editors the choice? Some organizations have compliance regulations that require any sort of conversational transaction to meet certain criteria. Perhaps you only need to disable commenting temporarily while you build a case to prove compliance. Or perhaps you’ve determined it’s not compliant or have some other reason for wishing to globally disable page comments.
No matter your reasoning, here’s the how:
Disable modern page/news comments globally in SharePoint 2019 via PowerShell
The script below will iterate through all site collections in a web application, and all of the subsites within each site collection, and turn off page comments for sites that haven’t already had them disabled. This does not delete page comments. If you re-enable the feature later, the comments that were there previously will be restored.
Log onto a SharePoint server and run the following PowerShell script, replacing the site URL with your own web app’s URL:
Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue
Get-SPWebApplication "https://sharepoint.contoso.com" | Get-SPSite –Limit All | Get-SPWeb -Limit All | ForEach-Object {
if($_.CommentsOnSitePagesDisabled = "False")
{
$_.CommentsOnSitePagesDisabled = $True
$_.Update()
Write-Host "Disabled page comments on " $_.URL -ForegroundColor Green
}
else
{
Write-Host "Page comments already disabled on " $_.URL -ForegroundColor Yellow
}
}
If you want a read-out to validate current status (False = not disabled, True = disabled), you can run the following script (again, replacing the URL with the web app of your own):
Get-SPWebApplication "https://sharepoint.contoso.com" | Get-SPSite –Limit All | Get-SPWeb -Limit All | ForEach-Object {
Write-Host $_.CommentsOnSitePagesDisabled $_.URL
}
Disable modern page/news comments globally in SharePoint Online/O365
1. Go to the SharePoint admin center at yourdomain-admin.sharepoint.com and select Settings from the left navigation menu.
2. Select Pages.
3. Uncheck Allow commenting on modern pages and click Save.
Saving a SharePoint site as a template saves you a time by making it so you don’t have to recreate similar apps (lists and libraries) and views for multiple sites that are mostly the same in structure and function. You can even save a site as template including its content (documents/items) so that you don’t need to re-upload the same content to each (such as blank worksheets, forms, guides, etc. you’ll complete/utilize on each site).
Examples of what to use site templates for
Frequently people might use site templates for project sites, where each project is going to have the same needs for communication and collaboration, and sometimes the same content such as project and budget worksheets or documents. You may also wish to use site templates for regular committee or group work such as annual event or semi-annual review processes and projects where you want a separate site to archive for each regular iteration of the group’s function.
How to create site templates
There are two methods I use to create templates of SharePoint sites. Either via Site Settings, or by simply modifying the URL of the site. Once created using one of the these methods, the template is saved to your site’s solution gallery and available to users creating new sites on the “Custom” tab of site template selection:
Save SharePoint site as template URL modification
To save a site as template, add _layouts/15/savetmpl.aspx to the end of the specific site or subsite’s URL. For example if you wanted Subsite C to be a reusable site template, you’d modify:
Then complete the fields (file name, template name, description, etc.) and choose whether or not the template should include the site’s existing content (documents and items) or if the lists/libraries should be empty on sites created using the template.
If you get the error The “Save site as template” action is not supported on this site, follow these steps then try again.
Save SharePoint site as template via settings
This requires the site to have never had SharePoint Server Publishing (site feature) activated on the site. See next section if it already has.
To save a site as a template via site settings:
1. Click on the settings wheel (upper right corner)
2. Click site settings (if classic) or site information > view all site settings (if modern).
3. Choose Save site as template from under Site Actions
Save site as template option missing from Site settings?
The option is removed when users activate SharePoint Server Publishing Infrastructure (site collection feature) or SharePoint Server Publishing (site feature). You can still activate the “save site as template” ability separately via PowerShell for the site then follow the steps for URL modification above to get to the “Save as template” form.