Skip to main content

Posts

Rest API Curd Operations

Reference urls https://www.codeproject.com/Articles/990131/CRUD-operation-to-list-using-SharePoint-Rest-API https://social.technet.microsoft.com/wiki/contents/articles/33795.sharepoint-2013-crud-operation-on-list-items-using-rest-api-services.aspx Retrive LIst Items function retriveListItem()  {  03.      04.      $.ajax  05.      ({  06.          url: _spPageContextInfo.webAbsoluteUrl + "/_api/web/lists/GetByTitle('companyInfo')/items?$select=Company,Industry",  07.          type: type,  08.          data: data,  09.          headers:  10.          {  11.              "Accept": "application/json;odata=v...

Setting default value for person column to current user in SharePoint 2013 using REST

Add a content editor WebPart to the New form of custom list and add the below code,  replace the  ID of your column highlighted yellow  SetUserFieldValue function parameter to your people picker column name. < script src = " //ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js " >< /script > < script type = " text/javascript " > $( document ).ready( function () { var userid = _spPageContextInfo.userId; function GetCurrentUser () { var requestUri = _spPageContextInfo.webAbsoluteUrl + " /_api/web/getuserbyid( " + userid + " ) " ; var requestHeaders = { " accept " : " application/json;odata=verbose " }; $.ajax({ url : requestUri, contentType : " application/json;odata=verbose " , headers : requestHeaders, success : onSuccess, error : onError }); } function onSuccess ( data , request ){ var loginName = data.d.Title; SetUserFieldValue( ...

Accordion "Left Navigation" (Quick Launch) for SharePoint 2013

For Expand/collapse "Left Navigation (Quick Launch) for sharepoint 2013 Copy the below code and paste in Master page jQuery(document).ready(function () {  /*set dynamic css logic*/  if($('#sideNavBox .menu-item.selected').length){   //propagates the selected class, up the three.   $('li.static').removeClass('selected');   $('#sideNavBox .menu-item.selected').parents('li.static').addClass('selected');   //collapses top siblings of selected branch   $('#sideNavBox .menu-item.selected').parents('li.static').last().siblings()    .find('> ul').hide();  }  else $('#sideNavBox .root.static > li.static > ul').hide();  /*set accordion effect*/  $('#sideNavBox .root.static > li.static').each(function(){   if($(this).find('ul').length){    $(this).addClass('father').click(function(){     if($(this).children('ul').css('display')...

Powershell Script to empty admin recyle bin in SharePoint

a script wherein if we give an user name for ex Deleted By "Bai,Mala(Mala)",it should delete the all the files which were deleted by user. Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue $siteURL = "your site url" $site = New-Object microsoft.sharepoint.spsite ( $siteURL ) $query = new-object Microsoft.SharePoint.SPRecycleBinQuery ; $query . ItemState = “FirstStageRecycleBin” ; $itemcoll = $site . GetRecycleBinItems( $query ); #Delete items those are deleted by Mala $files = $itemcoll | where { $_ . DeletedByName -match "your name" } #Delete output foreach ( $file in $files ) { $site . RecycleBin . Delete( $file . ID) }

Control when a document is displayed: Managing Item Scheduling

How to enable Scheduling Start Date and Scheduling End Date for pages /Documents library for Subsites. 1. After creating new Document library  / pages  go to List Settings. 2. In section General Settings select the link Versioning Settings, and enable" 1) Content approval to Yes . 2) Dcoument version history to created major and minor(draft) version . 3. In Section General Settings select the link " Manage Item Schueduling and select the option Enable scheduling of items in this list . 4. You will see Scheduling Start Date and Scheduling End Date in allitems pages.

Publishing SharePoint List InfoPath Form to a new location

Needed to move it from Dev to Production. File > Publish > Export Source Files. Close InfoPath Go to folder where Source Files are saved, open Manifest.xsf.  Find all instances of the URL and replace them with the new URL - there should be five. If you have secondary data connections, update those also. I use Notepad++ and “replace all” so it just takes a second.  Save the manifest.xsf file and close. Now right click on the manifest.xsf and select Design to open it back up in InfoPath.  Click on File >Publish and verify the URL is correct in the “Publish form to a SharePoint List” section”.

SharePoint 2013 - Suggested Content Browser Locations

In SharePoint Site collection, we can configure “Suggested Content Browser Locations” to access the directories easily. When we configure these locations, we can see them as drop down to the users when we select the content SharePoint. To view this link, we need to activate the publishing feature. We can configure suggested content browser location at site collection level. To configure suggested content browser locations, navigate to Site Settings, in the Site Collection Administration section, click on “Suggested Content Browser Locations” link. We can see the list. Click on new item to create new suggested location link. To check the suggested content browser location navigates to any page, edit the page. Select Insert option. In the Select Asset dialog, We can see the Suggested link drop down as shown the image below.

SharePoint 2013 Autocomplete textboxes using the term store and CSOM

 I am going to use a simple set of terms using state names in the From Sharepoint Deparment.  My terms are included in a group named  Classification  and a Term Set named  City and Department .  Here is what my term store looks like. We then need to add a heap of JavaScript references.  Some of these are included already, but specifically we need to load  SP.Taxonomy.js .  We also need to include  init.js  as I mentioned in an earlier  blog post . < script   type ="text/javascript"   src ="../Scripts/jquery-1.7.1.min.js"></ script > < script   type ="text/javascript"   src ="/_layouts/15/MicrosoftAjax.js"></ script > < script   type ="text/javascript"   src ="/_layouts/15/init.js"></ script > < script   type ="text/javascript"   src ="/_layouts/15/sp.runtime.js"></ script > < script   type ="text/javascript"   s...