Posts

Showing posts from 2015

Download all File Versions from SharePoint using PowerShell

SharePoint is a great platform for file versioning, and it is not uncommon that organizations wish to see or save all versions of a document or use an earlier version to re-create the document. Here we share a PowerShell script that downloads all versions of all files in a SharePoint document library. You can use the same approach for CSOM(client site object model), JSOM (JavaScript object model) or any other SharePoint object model.  Below is the code with explanations. Please study them before you download the script and change the site URL and document library name to your own. Code description Get the SharePoint site reference. $spSiteURL   =   "http://intranet.contoso.com/sites/jayant/" $spWeb   =   Get-SPWeb   -Identity   $spSiteURL  Get the document library as folder .  Here “Docs” is  the name of the document library ,  and I load it as SharePoint folder. $spDocFolder   =   $spWeb . GetFolde...

Shared JavaScript and CSS in Visual Studio SharePoint Solutions

Image
When you develop SharePoint solutions, especially SandBox solutions or apps, you write lots of code in JavaScript and design pages with CSS. In such cases it is always a good practice to create shared code for common tasks instead of writing repetitive code or copy from old projects.  It is also advisable to attach JQuery or other JavaScript or CSS libraries to your SharePoint Visual Studio solution. The advantage of attaching JQuery or other libraries is that if you update a file at the Master location, it gets updated in all your projects. There is no need to replace files in all projects manually.  Here at kalmstrom.com we always focus on good shared libraries that give fast and reliable development. As we develop standard solutions, we know that if we do it wrong the first time, we will have to go back and fix it later (at our own expense). Thus we need to always do it right from the beginning!  For a Visual Studio solution you can also add an existing fi...

Load JavaScript Files in SharePoint

Image
When you are coding SharePoint using JavaScript, you need to load JavaScript files, and SharePoint offers multiple ways to do that. The major methods are to register the file on a page, to always load the file by using the SharePoint CustomAction in Module and to load the file on demand by using the Script on Demand function. This is valid for all SharePoint versions. When a JavaScript file is registered on a page it is only available for that page, and this normally works good.  The problem comes when you are modifying the SharePoint ribbon using CustomAction and your CustomAction requires multiple JavaScript files. Then there are two loading methods available, to always load the files or to load them on demand.   It is not good to always load JavaScript files. It will slow down the entire SharePoint performance, because it loads the JavaScript files on ...