Friday, October 25, 2013

How to disable Custom Errors in Layout Pages / Application Pages in SharePoint 2013

For disable custom errors you need navigate to

C:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\TEMPLATE\LAYOUTS

and Open the web.config and make the CustomErrors off

<customErrors mode="Off" />

image

Thursday, October 24, 2013

Get List Item By Id with specified fields in SharePoint JavaScript Object Model

var ctx = new SP.ClientContext.get_current();
var web = ctx.get_web();
 
//Geting reference to the list
var olist = web.get_lists().getByTitle('Configs');
var oitem = olist.getItemById(1);
//get Title,id,ConfigItem fields
ctx.load(oitem, "Title", "Id", "ConfigItem");
ctx.executeQueryAsync(function () {
 
    alert(oitem.get_item("Title"));
    alert(oitem.get_item("ConfigItem"));
 
}, function (a, b) {
    alert(b.get_message());
});