Saturday, June 24, 2017

SharePoint Storage and Recycle Bin - Revisit

The Recycle Bin is a location where deleted files or folders are temporarily stored ,this feature is available in every version of Microsoft Window OS.

When you purposely or unknowingly you  delete the file or folder, it will be sent to recycle bin. You can restore it later to where it was actually stored earlier.

But reminder, if you choose to delete the file through DOS command or Shift +Delete, then you cannot retrieve it .

Its a different story on recovering the file from your disk through third party software.

The same analog available on the Microsoft SharePoint too. When the user collaborating with each users, there could be a chance to create the version of the document and finally check in the major version.

This approach considerably occupies the storage space available or allocated to the Site collection.

In SharePoint, when you upload any documents or creating the page, it will be stored in the SQL table as Binary format. There will not be physical location on the SharePoint server.

you can modify the site quota by going into your SharePoint Central Administration page.

Click on Application Management link from the left hand side menu. On the Application Management Page, Click "Configure quotas and lock" on the page , select the site collection in which you want to allocate more storage.

By default "No quota" template will be applied to the site collection, that means unlimited storage available.

You can also create the "Storage quota" template by clicking the "Specify quota template".


 That will help you to manage the storage quota and send the email warning to use when the site collection reaches the specified storage.


Here I have created my own quota template, Central Admin->application Management->Site Collections->specify quota template.

I have set the 25 MB size and name the quota template. By default SharePoint 2013 team site template occupies 1.94 MB , So I can use only 23.06MB and uploaded the documents more than 15.3MB and SharePoint does not save the document that exceeds the quota template size.


Your changes could not be save because this SharePoint website has exceeded the storage quota limit, you must save your work to another location.Contact your administrator to change the quota template for the website.



SharePoint Recycle Bin always connected with your Storage quota and keep on monitoring the size of your site collection.

If any user delete the document sized 2 MB, It will go to the first stage recycle bin and storage will never gets decreased.

You can determine the SharePoint site collection's storage through this code snippet
  
using (SPSite site = new SPSite(SPContext.Current.Site.Url))
      {
         Decimal SiteSize = new Decimal((site.Usage.Storage / 1024f) / 1000);
         Response.Write(SiteSize.ToString() +"MB");
     
      }

Another way of finding the site collection's size will be using SharePoint Designer.
Open the site collection through SharePoint Designer on the Site's Dashboard page, you can see the site the "Total storage used" underneath "Site Information".


Earlier my site collection was .2.51 MB and then added 3.13 MB sized video file to SharePoint and checked and now site collection became 5.64 MB fat.



When your site collection administrator delete the document from second stage storage will be freeze.

To manage the storage on your site collection , you can do some capacity plan and set it at your "Web application".

It precisely, help you to control, how long your deleted items can be stayed in the first stage and second stage recycle bin. To do this, Go to Central Administration->Select your webapplication-> General Settings, Under Recycle bin change these values as per your  storage capacity plan.








This process will be managed and governed by the timer job called "Recycle Bin" You can find it under "Monitoring-> Timer Job - > Review Job Definition.

If there is any problem with this timer job, you cannot able to see the correct size and track the all the site storage.

In the next blog, I will give you the brief about "SharePoint 2013 Storage Metrics" and how its useful to track and monitor of the file size and the quota of the file occupied in the site collection.