Read DateTime data from Excel file using C#

Excel files are very tricky to deal with, sometimes it returns double value, sometimes just plain string.

The example processes values read by EPPlus, might be useful in other situations, too.

public DateTime GetDate(object valFromExcel)
{
if(valFromExcel is DateTime) return valFromExcel;
if(valFromExcel is double) return DateTime.FromOADate((double)valFromExcel);
return Convert.ToDateTime(valFromExcel);
}

How to organize Javascript code

Make intensive use of namespaces, don’t use globally declared functions

//if the namespace has already been declared, use the existing one, otherwise create an empty object
//for the namespace
var theNamespace = theNamespace | {};

//assign functions and objects in the namespace by setting properties.
theNamespace.aFunction = function(){};

Using namespace will help avoid functions with same name being overridden by each other.

Deployment stuck at deploying in Sharepoint Solutions Manager

From Central Admin, go to  System Settings > Manage Farm Solutions, then “stop” the deployment of the WSP from there.
Before deploying the solution using central admin, make sure that the sptimer service and sp web services root application pool is running on all servers (WFE and APP)
The reason why it got stuck is that it couldn’t complete the deployment on one or more servers. Make sure that all the servers are accessible and have enough space.

Read SharePoint workflow status in JavaScript

Source: http://sharepoint.stackexchange.com/questions/94648/sharepoint-2013-check-workflow-status-programmatically-javascript

var context = new SP.ClientContext.get_current();
  var web = context.get_web();
  var list = web.get_lists().getByTitle(listTitle);
  var listItem = list.getItemById(listItemId);  
  context.load(listItem);
  context.executeQueryAsync(
     function() {
       var workflowStatusField = listItem.get_parentList().get_fields().getByTitle(workflowTitle); //get workflow status field
       var workflowStatusValue = listItem.get_item(workflowTitle); //get workflow status field value
       success(workflowStatusValue);
     },
     error
  );