Posts

Showing posts from 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

How to update a Hyperlink field using REST API in SharePoint 2013

below code snippet helps to update the Hyper link filed in SharePoint 2013 using REST API $.ajax     ({         url: _spPageContextInfo.webAbsoluteUrl + "/_api/site/rootweb/lists/GetByTitle('ListName')/items",         type: "POST",          headers:         {             "Accept": "application/json;odata=verbose",             "Content-Type": "application/json;odata=verbose",             "X-RequestDigest": $("#__REQUESTDIGEST").val(),             "X-HTTP-Method": "POST"         },          data: JSON.stringify         ({             __metadata:             {                 type: "SP.Data.ListnameListItem"             },              Link:{Url: 'http://google.com', Description:'Google'}         }),         success: function(data, status, xhr)         { // alert('success');                   },         error: function(xhr

SharePoint 2013 task approval form redirect to EditFrom from DispFrom

One Click Approval for SharePoint 2013 Tasks: 1. Open the task list in SharePoint Designer and create a new List Form 2. In the Create New List Form window, set the Filename as “RedirectToEditForm”, the type as Display, and check “Set as the default for the selected type”. Also pick your Workflow Task content type. 3. Open the Form in Designer so that the code is displayed, then click the “Advanced Mode” button in the ribbon bar. This will open the entire page for edits. 4. Insert the following javascript directly after the line <asp:Content ContentPlaceHolderId="PlaceHolderMain" runat="server"> (this is around line 15) ? 1 2 3 4 5 6 7 <script type= "text/javascript" >      <!--      var origUrl = window.location.toString();      var editUrl = origUrl.replace( "RedirectToEditForm" , "EditForm" );      window.location = editUrl;      //--> </script> 5. Save the fo

SharePoint 2013 get Person or Group field value(s) using REST API

Below  Code snippet for fetching the Person or Group field value by using REST API.  $.ajax ({                url: _spPageContextInfo.webAbsoluteUrl + "/_api/web/lists/GetByTitle('Produccts')/items('"+ietmID+"')?$select=Title,Flag,Approver/Title&$expand=Approver",         type: "GET",         headers:         {             "Accept": "application/json;odata=verbose",             "Content-Type": "application/json;odata=verbose",             "X-RequestDigest": $("#__REQUESTDIGEST").val(),             "IF-MATCH": "*",             "X-HTTP-Method": null         },         cache: false,         success: function(data)         {             var listiteminfo = data.d;       var itemTitle=listiteminfo.Title;       var approvers="";       var approverResults=listiteminfo.Approver.results;             for (var j = 0

SharePoint 2013 Interview questions

SharePoint 2013 is a big Change from SharePoint’s earlier Versions. With the Introduction of new UI, new development model and a lot of Performance Improvement Capabilities, SharePoint 2013 is a huge hit among SharePoint Communities and Business. To grab a job as an expert however can be Challenging. An ideal candidate is expected know a ton of new features and a good idea about where and when to use them. In this SharePoint 2013 Interview questions series we will look at Administrator,IT Pro and Development SharePoint 2013 Interview questions and answers that could help you get started. A huge collection though will be posted soon as an ebook. Q1: What is new SharePoint 2013? Ans:  SharePoint 2013 is the next Version of Microsoft’s famous Collaboration and Document Management Software called SharePoint.This Version follows SharePoint 2010 that was released back in May 2010.SharePoint 2013 was released (as Preview and RTM versions) with some new & exciting features such as Real