Retrive Choice Field from SharePoint 2010/2013 list CSOM

Following JavaScript uses CSOM to find all choices in a field within a SharePoint list or library.

$(document).ready(function($) {
    //Wait for sp.js to load..
    SP.SOD.executeFunc('sp.js', 'SP.ClientContext', initApp);
});

function initApp(){
    //context variables
    var context = new SP.ClientContext.get_current(), web = context.get_web(), lists = web.get_lists();
    //Call function
    getChoiceFieldFromList('ListName','ListChoiceColumn', context, lists);
}


//* RETRIVE CHOICE COLUMN FROM LIST - CSOM *//
function getChoiceFieldFromList(library, column, context, lists){
    // GETS LIST BY NAME
    var currList = lists.getByTitle(library);
    
    //LOAD CURRENT LIST
    context.load(currList);

    // Get Priority field (choice field) and load it!
    var priorityField = context.castTo(currList.get_fields().getByInternalNameOrTitle(column),SP.FieldChoice);
    context.load(priorityField);

    // CALL SERVER
    context.executeQueryAsync(onSuccessMethod, onFailureMethod); 

    function onSuccessMethod(sender, args) {

        // Get string arry of possible choices (but NOT fill-in choices)
        var choicesOutput = "";

        var choices = priorityField.get_choices();
            //looping trough choices
            for (var i = 0; i < choices.length; i++) {
                //Logging every choice
                console.log(choices[i]);
            }
    }

    function onFailureMethod(sender, args) {
        console.log(args.get_message());
           alert("oh oh!");
    }
}

How to implement responsive design into SharePoint 2013 masterpage

This is a demo on how you make your SharePoint 2013 responsive to any device. I am going to implement Skeleton responsive design framework into SharePoint 2013 by using “Design manager”. Design manager is the new way of implementing design and page layouts to SharePoint.


Synkronisere AD thumbnail med SharePoint 2010

For å synkronisere AD miniatyrbilder (thumbnail) med SharePoint 2010 må du ha lagt inn noen bilder i AD og ha tilgang til SharePoint PowerShell konsollen.


Great free fonts from fontsquirrel


SharePoint 2013

Neste blogginnlegg skal omhandle hvordan man implementerer responsiv design i SharePoint 2013 ved bruk av “Design Manager”. Jeg vil implementere rammeverket Skeleton