Posts

Showing posts from May, 2017

Common Date Time formulas for Sharepoint – Calculated Fields

Get Week of the year =DATE(YEAR([Start Time]),MONTH([Start Time]),DAY([Start Time]))+0.5-WEEKDAY(DATE(YEAR([Start Time]),MONTH([Start Time]),DAY([Start Time])),2)+1 First day of the week for a given date: =[Start Date]-WEEKDAY([Start Date])+1 Last day of the week for a given date: =[End Date]+7-WEEKDAY([End Date]) First day of the month for a given date: =DATEVALUE(“1/”&MONTH([Start Date])&”/”&YEAR([Start Date])) Last day of the month for a given year (does not handle Feb 29). Result is in date format: =DATEVALUE (CHOOSE(MONTH([End Date]),31,28,31,30,31,30,31,31,30,31,30,31) &”/” & MONTH([End Date])&”/”&YEAR([End Date])) Day Name of the week : e.g Monday, Mon =TEXT(WEEKDAY([Start Date]), “dddd”) =TEXT(WEEKDAY([Start Date]), “ddd”) The name of the month for a given date – numbered for sorting – e.g. 01. January: =CHOOSE(MONTH([Date Created]),”01. January”, “02. February”, “03. March”, “04. April”, “05. May” , “06. June” , “07. July” , “08

Delete root site List Items using SharePoint 2013 REST API

Hi All, Here is my code snippet, i am passing the item IDs in an array. below code is working to delete parent site(root site) list items using the REST API function deleteiteminListAllDocs(itemIDarr)  { for(var j=0; j<itemIDarr.length;j++) { var itemID=itemIDarr[j]; console.log(itemID); $.ajax     ({       // url: _spPageContextInfo.siteAbsoluteUrl + "/_api/site/rootweb/lists/GetByTitle('ProductInfo')/getitembyid('"+itemID+"')",       url: _spPageContextInfo.webServerRelativeUrl+ "/_api/site/rootweb/lists/GetByTitle('ProductInfo')/items('"+itemID+"')",       type: "DELETE",        headers:        {            "accept": "application/json;odata=verbose",             "X-RequestDigest": $("#__REQUESTDIGEST").val(),             "If-Match": "*",              "X-HTTP-Method": "DELETE&

create button in List/Library view for each item

// loop through all views on the page $("table.ms-listviewtable").each(function(a) { // is the WebPart view named  with list name ? if ( $(this).attr("summary") == "ListName")// here list name is your List name { // open the TBODY tag $(this).find("tbody").each(function(b) { // loop through <tr> tags (table row) $(this).find("tr").each(function(c) { var docItemID = ""; // loop through <td> tags (table columns) // find the Item ID for this document $(this).find("td").each(function(d) { $(this).find("div.itx").each(function(e) { docItemID = $(this).attr("id"); console.log("FOUND IT: " + docItemID); }); }); // append the button html as the last column in the row if (docItemID.toString().length > 0) { $(this).append