Friday, September 30, 2016

how to get more than 100 items in a rest call in SP workflow

pathetically, sharepoint workflow bombed when i tried to get the __next parameter

with

System.ApplicationException: HTTP 500  {"Transfer-Encoding":["chunked"],"X-SharePointHealthScore



so i changed the call to say gt ID - initially ID= 0 and when i looped through the first 100 i set the ID to the new id's - then I ran the call again - gt ID so it got the next group

Wednesday, September 28, 2016

Thursday, September 22, 2016

sharepoint and word

share point stores attributes of the document set in the actual word document so if you upload again unless the attributes are overwritten they will retain the old attributes

if your changes to the header on the first page dont apply to the other pages...


Thursday, September 15, 2016

SharePoint Designer

is evil. If you change a variable data type in the local var windows - it wont really change the used variable type.
You have to rewrite with a new name

simple jsom to get an item

Utils.getListItemByID = function (listName, itemID ){
var dfd =  $.Deferred();
context = SP.ClientContext.get_current();
web = context.get_web();
oList = web.get_lists().getByTitle(listName);

var currentItem = oList.getItemById(itemID);

context.load(currentItem);
context.executeQueryAsync(
function(){
dfd.resolve(currentItem);
},
function(sender,args){
dfd.reject(args.get_message());
}
);
return dfd.promise();
}


Utils.getListItemByID('blah', 36).then(function(item){ console.log(item.get_item('blahName')) },function(sender, args){ console.log(args.get_message())});

CAML and SharePoint folders

make sure the query is recursive

e.g.
'</In></Where><QueryOptions><ViewAttributes Scope=\'Recursive\' /> </QueryOptions></Query></View>';


later I found this to work better

<View Scope="RecursiveAll">

Tuesday, September 13, 2016

nice pattern for jsom async calls


pass the call backs as parameters to the function



function getSiteField(fieldName,success,failure)
{
     var ctx = SP.ClientContext.get_current();
     var rootWeb = ctx.get_site().get_rootWeb();
     var field = rootWeb.get_availableFields().getByInternalNameOrTitle(fieldName);
     ctx.load(field);
     ctx.executeQueryAsync(
         function(){
            success(field)
         },
         failure);
}
SP.SOD.executeFunc('SP.js', 'SP.ClientContext', function() {

   //get Title column and print its properties
   getSiteField('Title',
    function(field){
       //print field properties
       console.log(field.get_title());
       console.log(field.get_internalName());
       console.log(field.get_typeAsString());
       console.log(field.get_description());
    },
    function(sender,args){
       console.log(args.get_message());
    });

});

got it here

Friday, September 9, 2016

don't use includes

use indexOf instead (ie etc)

source in sharepoint forms url

use decodeURIComponent to convert ampersands to url encoding

Wednesday, September 7, 2016

Monday, September 5, 2016