Wednesday, 2 May 2018

SharePoint: How to use IF condition in InfoPath form formula?


if (BoolCondition) {
   TrueResult
}
else {
   ElseResult
}


becomes

concat(

substring(TrueResult, 1, (BoolCondition) * string-length(TrueResult)),

substring(ElseResult, 1, (not(BoolCondition)) * string-length(ElseResult)))


Source: https://blogs.msdn.microsoft.com/infopath/2006/11/27/conditional-default-values/

Tuesday, 17 April 2018

[Solved] SPServices : GetListItems not returning all items from SharePoint list?


'GetListItems' will return items from default list view only.

To overcome this use the following filters:

var cmlQuery="<Query><Where><Neq><FieldRef Name='ID' /><Value Type='Counter'>0</Value></Neq></Where></Query>";

CAMLQuery: cmlQuery//Include items which are filtered-out in default view
CAMLRowLimit: 0//Override default view row-limit

Friday, 13 April 2018

How to increase the width of a column in SharePoint 2013 list?


Add the following in script editor:

<style type='text/css'>
.ms-vh-div[DisplayName='Column Display Name']
{
  width:400px;
}
</style>

Thursday, 12 April 2018

Friday, 6 April 2018

How to mass check-in SharePoint library files?


Here is a way to check in multiple files at once:

First, if you don't have ownership of the files then go to library settings. Click on 'Manage files with no checked in version'. Select all and take ownership.

If not already available, create a view with filter as following: 'Check Out To' = [Me].

Go to content and structures from site settings. Go to the view you just created. Select all files and check-in using the action tab.

Tuesday, 3 April 2018

SPServices : How to prepare date data for the SharePoint list date field using JavaScript?


var currDate = new Date();

var numDay=currDate.getDate();
var numMonth = currDate.getMonth();
var numYear = currDate.getFullYear();

var tempDate = (++numMonth)+"/"+(numDay)+"/"+numYear ;
var spDate = new Date(tempDate).toISOString();

//e.g. 2019-08-29T18:30:00.000Z


Note: You may have to adjust numDay based on the timezone.

How to fetch the email of the current user using SPServices?



$( document ).ready(function(){

 currUser = $().SPServices.SPGetCurrentUser({

  fieldNames: ["WorkEmail"],

  debug: false

 });

currUserEmail = currUser.split('p|')[1];

})