TrickyCoder – Best practices for SharePoint a Document Management System – part 1

Companied who has adopted sharepoint as their document management system have some common issues for their document libraries, particularly in the case where a best practice is not followed for the document libraries.

The common issues that are faced are:

  • Usability
  • Lengthy URLs exceeding the URL length limitation
  • Navigation
  • Cost
  • Large libraries exceeding the 5,000 item list view threshold limit
  • Cannot co-author Microsoft Office documents
  • Data save conflicts. Security
  • User experience
  • File duplication
  • 1 Lonely View
  • Cannot sort and filter
  • Lost documents
  • Change is hard

Most of the times companies ask us to migrate thier Network share files to the SharePoint Document library.

To fullu take advantage of the SharePoint, it is always advise to convert the file share system to sharepoint using the best practices.


Enable library versioning to ensure a complete version history is kept and maintained. This allows document changes to be tracked, and provides a mechanism to allow users to restore from previous versions if required and view details on past changes made.

Key benefits:

  • Store Major and/or Minor versions on documents in the library, providing the option for restoring previous versions if/when required
  • Track changes on documents.


To improve the performance of a large list or library, you can index a column. An index on a column enables SharePoint to quickly analyse the data in that column, even when working with thousands or millions of items. For a view to quickly filter through a large number of items, the filter must be applied to a column that is indexed.

Key benefits:

  • Indexed columns in document libraries bypasses the 5,000 items list view threshold limit
  • Improved performance and helps manage large libraries.


Document libraries must have a logical name to make the document management solution intuitive to use and ensure content is uploaded into the correct location. This would improve user adoption and collaboration.

File naming conventions are recommended to be named in a logical manner and short to ensure URL length limits are adhered to. It is highly recommended to not use any special characters in folder names, file names and also in document library names. Special characters such as ampersand, are not to be used. Always use alpha and numeric characters only.

Key benefits:

  • Logical naming of document libraries and file names improves navigation and makes the system more intuitive
  • Shorter and more user friendly URLs and no special characters used ensures continual system availability and functionality with improved usability.


To avoid hours of adding tags to bulk uploads, using one type of content per library can save time. This means organizing content distributed across different libraries can aid in reducing time required to tag documents in their corresponding libraries.

What are the benefits of implementing this best practice?

Key benefits:

  • Structure document libraries to store individual content types, shortening the time required to bulk tag documents
  • Improves content organisation and find-ability.


Do not use folders to store content in document libraries because this can cause issues such as users misfiling documents, documents getting lost in nested folders, and it’s more time consuming to navigate around document libraries to locate content.

Tagging is preferable because it is more flexible. It also means you can view items by different classifications, which enriches the functionality of your library. Metadata provides the ability to view the list of files in the document library in different ways that allows you to find content quicker and also produces quality reports that is virtually impossible using folder structures.

Key benefits:

  • Better organisation of content
  • Ability to filter and group content using metadata
  • Provide useful reporting of content in document libraries
  • Improved content find-ability
  • Eliminates chances of documents getting lost in nested folders
  • Minimises chances of content getting misfiled.

For more of the best practice ideas visit the next post.

Resolve the Session Timeout issue in the SharePoint Provider Hosted add-in

I am working on a SharePoint Provider Hosted app for a long time now. I have a good amount of experience in working with the SharePoint’s App Model and especially with the SharePoint Online.

Currently I am working on same type of project which is hosted in azure and deployed in SharePoint Online.

Project module is already deployed to production environment and clients are using them happily.

But today client has come with an issue of they are not able to submit the form.

Problem: Client is not able to submit the form from the Provider hosted app which has the code hosted on azure.(I have used the MVC as the back end to write the code with C#)


  • I have tried to submit the test data and it submitted without error
  • I have tried to submit the data with the same data as client is submitting still it has submitted successfully.
  • So to trouble shoot the issue properly I went a call with the client it submitted successfully during the call too.
  • While I was on a call with a client at that time client stated that it took him almost 1.5 Hours to capture the data to be submitted and during that period form is opened and in ideal state.
  • At that I got a strike in my mind that this is the issue of session timeout for the MVC application

Root Cause:

  • So I started to regenerate the same issue by putting the page ideal for 30 minutes as I know there is a default timeout of 20 minutes and viola I am able to regenerate it.


  • After so much of trial and error finally I am able to resolve this issue by adding a dummy call to an ActionResult which does nothing and simply returns the “Success” as JSON result.
  • Then I wrote up a java script block in a java script file and then reference it to the shared view.
  • A JavaScript block calls that dummy action every 5 minutes to keep the session alive.

If you are using ASP.NET MVC – you do not need an additional HTTP handler and some modifications of the web.config file. All you need – just to add some simple action in a Home/Common controller:

public JsonResult KeepSessionAlive() {
    return new JsonResult {Data = "Success"};

write a piece of JavaScript code like this one (I have put it in one of site’s JavaScript file):

var keepSessionAlive = false;
var keepSessionAliveUrl = null;

function SetupSessionUpdater(actionUrl) {
    keepSessionAliveUrl = actionUrl;
    var container = $("#body");
    container.mousemove(function () { keepSessionAlive = true; });
    container.keydown(function () { keepSessionAlive = true; });

function CheckToKeepSessionAlive() {
    setTimeout("KeepSessionAlive()", 300000);

function KeepSessionAlive() {
    if (keepSessionAlive && keepSessionAliveUrl != null) {
            type: "POST",
            url: keepSessionAliveUrl,
            success: function () { keepSessionAlive = false; }

and initialize this functionality by calling a JavaScript function:


Please note! I have implemented this functionality only for authorized users (there is no reason to keep session state for guests in most cases) and decision to keep session state active is not only based on – is browser open or not, but authorized user must do some activity on the site (move a mouse or type some key).

Courtesy: Maryan

Do let me know if you are able to resolve this or have any other concerns in a comment box below.

Happy Share Pointing!!!