Posts

Showing posts from 2014

REST API for SharePoint

In SharePoint 2010, Microsoft has introduced REST API as an alternative to web services for accessing data and performing CRUD operation in SharePoint. And in 2013 version of SharePoint, REST API has evolved as a the alternative to customization using client side scripts and cross-site scripting. And REST is very useful in developing SharePoint hosted apps as in this kind of app, we can use only client side scripting( ECMA, JavaScript) and not managed code written in C#. REST API is basically uses http methods to perform CRUD operations and major task involved is creating url with headers and passing data wherever required in the body of http request. And in response we will get the result in the form of JSON object. So in this blog series I'm going to cover CRUD operation involving Web List and Libraries List Items Fields Files and Folders Users and Groups In the next blog post we will see how to perform CRUD operation involving web object. So, then stay tuned.

How to flush the BLOB cache using powershell script

In this blog post I'm going to show you how to flush the BLOB cache using powershell script. Add-PSSnapin Microsoft.SharePoint.PowerShell -erroraction SilentlyContinue $webApp = Get-SPWebApplication "http://webapplicationurl/" [Microsoft.SharePoint.Publishing.PublishingCache]::FlushBlobCache($webApp) Write-Host "Flushed the BLOB cache for:" $webApp Hope this script will solve problems of people facing issues with SharePoint BLOB cache.

Release SharePoint site Lock using PowerShell Script

In this blog post I'm going to show you a PowerShell Script for releasing site lock. Add-PSSnapin Microsoft.SharePoint.PowerShell -erroraction SilentlyContinue $Admin = New-Object Microsoft.SharePoint.Administration.SPSiteAdministration("http:// sitecollection ") $Admin.ClearMaintenanceMode() $site = Get-SPSite -Identity "http://sitecollection" Write-Host $site.MaintenanceMode Hope this will help people facing the lock problem in SharePoint.

Download All Documents in SharePoint Web using Powershell Script

Image
In this blog post I'm going to show you how to download all document using Powershell script on your local drive. Please follow the below steps: 1. Creating commandlet bindings (command variables) 2. Add-PSSnapin statement for importing SharePoint library. 3. Now creating a recursive function for traversing all the folders in the specified folder and downloading it to local folder. In the second foreach loop we are checking if Folder not exists on local drive then create the folder and then call DownloadAllItemInFolder function recursively. 4. Create the instance of Site, Web and Folder to call  DownloadAllItemInFolder function. Once the downloading finished, dispose off the Site object. Full script can be downloaded from here . Below is the sample command to run this script. .\DownloadSPFiles -SiteCollectionUrl "http://siteurl" -SPFolderPath "<Folder>" -LocalDir "C:\BackupFiles" In that script I've used the Root Web for...

OrgChart Using JQuery and SharePoint List

Image
In this blog post I'm going to display how to build our own Organization chart with the help of JQuery by fetching data from SharePoint List. In this example, I've used the standard jQuery.Orgchart library from this link . Please follow the below steps to generate the Chart: Create a SharePoint List using custom list template and define the hierarchy Create a lookup column of same list. Example, Supervisor column is a lookup of 'Org Chart' list. Now add a content editor webpart on a page. add the jquery references in content editor webpart. <link rel="stylesheet" href="_layouts/jquery.orgchart.css" /> <link rel="stylesheet" href="_layouts/jquery-ui-1.10.3.custom.css" /> <script src="_layouts/jquery-1.9.1.js"/> <script src="_layouts/jquery-ui-1.10.3.custom.js"/> <script src="_layouts/jquery.orgchart.js"/>  Now create a new customorgchart.js file into s...

Multiple Background Images in HTML

In this article I’m going to demonstrate how we can use multiple background images for any html element. Those who have knowledge of HTML5 and CSS3 can do it easily using the already provided functionality. But all browser’s doesn’t support HTML5 and CSS3, so for these browser to work we need to do little customization. First I’ll demonstrates how to Use multiple background images in HTML5 and CSS3 Use multiple background images in lower versions of browser.   Multiple background images in HTML5 and CSS3 With CSS3 we case easily define multiple backgrond images in a single line like this background:url('../images/bg2.jpg') fixed left top no-repeat, url('../images/bg2.jpg') fixed right top no-re peat,url('../images/bg_strip.jpg') fixed center top repeat-x;  Workaround for unsupported browsers Some browser doesn’t support multiple background images (example IE 8 and below versions, Firefox 13 and below versions), so as a workar...

Clear SharePoint Site’s Recycle Bin using PowerShell Script

In this blog post I’m going to display how to delete all items from recycle bin of any SharePoint Site using PowerShell script. Steps: PowerShell script we can get the object of SPSite and SPWeb like this $Site = Get-SPSite “SiteUrl” $RootWeb = $Site.RootWeb We can iterate through all the subsites in any site using foreach loop foreach($web in $RootWeb.Webs) Next we need to call the DeleteAll method of Recycle Bin. {       $web.RecycleBin.DeleteAll(); } Next we need to clear the level 2 recycle bin i.e. at site collection level $Site.RecycleBin.DeleteAll(); And lastly we need to dispose the SPSite object $Site.Dispose();   That’s all you need to delete all items from recycle bin.

Customize SharePoint RichText Editor

Image
Sometimes we need to remove some buttons from the RichTextEditor control of SharePoint for some page or a particular website. Since, RichTextEditor control uses global Form.js, so we can’t directly modify that js as it’ll impact entire farm. To deal with this kind of scenario, I’ve created a copy of form.js and uploaded it into our site, and then modified it to remove some buttons. There are functions in form.js for different RichTextMode   Compatible: RTE_GetCompatibleToolBarDefinition FullHtml: RTE_FullHtmlToolBarDefinitionFactory Open the copy of form.js from our site and then search form the above functions and comment out “toolBar.push” for the button in appropriate function and check-in the js file. Now open in SPD and paste the below script at the bottom of the page. <script type="text/javascript">                 function removejscssfile(filename, filetype){ ...