Tidying up and creating space, many of us have dealt with this topic in one way or another in this year that is now coming to an end. Some people may be planning a clean-up campaign at the end of the year or making good resolutions for the next year.
Regular tidying up is also a good idea in the SharePoint environment. Depending on usage behavior or the size of the managed files, the available storage space can become scarce if you are not careful. And renting additional storage capacity is an expensive proposition.
Just like in your own home, a good first step towards more order here is simply emptying the wastebasket (as simple as that may sound).
In contrast to the home environment, this task is even completed automatically in SharePoint, since every deleted element is finally removed from the recycle bin after 93 days. But if there are many large files in the Recycle Bin, this period may well be too long, and a shorter purge interval would be desirable.
However, a corresponding setting cannot be made directly in SharePoint. The solution is a PowerShell script with the PnP SharePoint Online library, which serves as an intermediate layer to the actual API.
In order for it to run automatically, the login data should be saved in encrypted form next to the script in a file. This encrypted file can only be used on the computer on which it was created.
A scheduler task is then created for the automatic process, which starts the script in a time-controlled manner. And the virtual recycle bins are emptied at the desired deletion interval and the storage capacities are relieved.
We’d be happy to help you put your clean-up resolutions into action!