Sharepoint 2013

SharePoint Online Data Restoration Timeline

SharePoint online has a data backup and restoration policy which for some users might be confusing. The following article will provide you a clarity to an extent.

In short a data can be restored within 108 days until unless it’s prematurely deleted by admin, in which case the data can be restore 14 days from premature deletion by admin.

User deleting a data:
When a user deletes a list item, or document library item or any site object, that deleted data is moved to a site’s recycle bin and stays there for 93 days or till user deletes it or site collection recycle bin quota exceeds.

User deleting a site recycle bin item:
When a user deletes an item from site recycle bin, that item is moved to site collections recycle bin. Only the site collection administrator will have access to this recycle bin. Here too the item stays there for 93 days from the date the user deleted it originally or till admin deletes it or site collection recycle bin quota exceeds.

Note:
Make a note that an item deleted by user will stay for 93 days regardless of it being there in site recycle bin (can be restored by user) or site collection recycle bin (can be restored by admin).

Admin deleting an item from site collection recycle bin/auto deletion:
Once an item is deleted from site collection recycle bin, it still can be restored if it’s available in the data backup by Microsoft
taken twice daily. Again this backup is available only for 14 days and SharePoint admin has to raise a support ticket.

Note:
When Microsoft restores the data, they will restore it as a whole site collection and not as individual item.

Pictorial Representation:

SharePoint Online Data Restoration Timeline
SharePoint Online Data Restoration Timeline

Source:https://kannan.page.link/XQFV


Get folder and files recursively in SharePoint using REST call

There was a simple requirement I came across for which a page should list all the files and folders in a SharePoint document library.

I came up with a solution using ODATA call. Following is the REST call I made to get the list of all folder and files.

/_api/web/Lists/GetByTitle(‘Documents’)/Items?$select=FileLeafRef,FileRef&$orderby=FileRef asc
Following is the code which quickly prints them out in a table. Just add this code to a script editor web-part.
Please make sure the URL is updated based on your site URL.

 

Enable tree view in current navigation within SharePoint

Sometime we need to enable tree view in current navigation to help navigate within document libraries.

Traditional Way:

Site Settings -> Look and Feel: Navigation Elements -> Check ‘Enable Tree View’

Programmatic way using PnP Powershell:

Disable ‘Allow items from this site to be downloaded to offline clients’ in SharePoint

Sometime we need to disable the “Sync” button in SharePoint document libraries and that can be done by the following methods.

Traditional Way:

Site Settings -> Search: Search and offline availability -> Set ‘Allow items from this site to be downloaded to offline clients?’ to “No”

Programmatic way using PnP Powershell:

Sharepoint disable drag and drop

In some scenarios we might need to disabled drag and drop in SharePoint sites.

The following code works when we need to disable a page with one document view.

Add the html code in content editor web part where the document view is there.

For pages with multiple document libraries when you want to target a specific library prepend the id of the web part div and an underscore e.g. WebPartWPQ4_

Source: https://sharepoint.stackexchange.com/questions/82805/how-can-i-disable-the-document-library-drag-and-drop-function

Open SharePoint Office documents in modal dialog

Sometimes we need Microsoft Office documents to be opened in dialogs instead of SharePoint’s default behavior which is opening the document in the same window or tab.

The following code helps in implementing this.

Note: This code only works for office documents. For pdf documents look at the previous article.

 

Open SharePoint PDF documents in modal dialog

Sometimes we need PDF documents to be opened in dialogs instead of SharePoint’s default behavior which is opening the document in the same window or tab.

The following code helps in implementing this.

Note: This code only works for PDF documents. For office documents look at the next article.

 

Displaying SharePoint’s “Please wait…” or “Working on it…” dialog box

The following code helps in displaying the “Working on it…” dialog box available in SharePoint 2013 or SharePoint Online.

Before you being the background operation, call the function “RequestStarted“. Once the background operation has been completed, call the function “RequestEnded“.

Source: Sharepoint Stackexchange

Change new item text in SharePoint

The following script changes the “new item” link button in SharePoint view form to whatever we desire.

Add either of the script to content editor web part.

Plain JavaScript version: (This code assumes that there is only one “new item” text in the entire page.)

jQuery version: (This code can replace any number of “new item” text)

Source: sharepoint.stackexchange.com

Hide SharePoint list column

Sometimes we need to hide specific SharePoint columns in a list view webpart. The following code will help with that.
Make sure this code is placed in a JS file and referenced using JSLink webpart property.
Just replace the HideColumn function’s array parameters [“Title”, “Created By”] with necessary column’s display names.