Skip to main content

Posts

Showing posts from May, 2012

Upload Master Pages & Page Layouts to Master Page Gallery using PowerShell

I am sharing a script to Upload Master Pages & Page Layouts to Master Page Gallery using PowerShell script. This script will allow users to upload files (Master pages and page layouts) on to Published/non published SharePoint sites. Download the script from here . Steps to execute script 1- Download the .zip file from here 2- Edit the “UploadMasterPages.bat” file and Change the <<site collection url>> in the text below with respect to the environment. e.g. http://sitecollectionurl 3- Save the “UploadMasterPages.bat” file and close it. 4- Put all of your master pages and page layouts to Doc folder. 5- Run “UploadMasterPages.bat” file as Administrator. 6- The files under “Docs” folder will be uploaded to the Master Page Gallery. Note: A log file is created on root directory after execution of script, check log file for details. I have posted the same article on TechNet gallery, you can have a look on this by click this link

Retrieving old file versions through Server Object Model

Recently I  have been asked about issue of retrieving old file versions from a SharePoint document library through server object model code, particulary check in comment for the major (published) versions. The first try was to retrieve data from the .Versions property of the SPListItem, or, from SPListItem.File.Versions, if we are talking about document libraries and files. And it worked – almost. The File.Versions property contains PREVIOUS file versions, and it does not hold the info on the current file version – this info is stored directly under the .File property. Here is a functioning piece of code to retrieve check in comment (or any other version information, for that matter), both for current and previous versions: using (SPSite site = new SPSite( "http://localhost" )) {      using (SPWeb web = site.OpenWeb())      {              SPList docsLis...

Hide the Ribbon in SharePoint 2010

In this post, you learn how to hide the ribbon in SharePoint 2010 by using JavaScript. About the Ribbon in SharePoint 2010 The SharePoint 2010 ribbon provides a similar user experience as the Microsoft Office client products. The ribbon is a toolbar which appears on top of the page to provide the most commonly used tools, controls, and commands. The ribbon hierarchy is organized as follows (see Figure 1 and Figure 2): Contextual Tag Group - A contextual tab enables you to provide a set of user interface (UI) controls within a certain context. For example, when you select a table in a document, a set of tabs is displayed to work with the table. When the table is deselected, the contextual tabs are hidden. Contextual tabs with a similar context are organized in a contextual tab group so you can have more than one tab in a group. Tabs – Tabs are used to organize groups of related controls. For example, an Insert tab displays controls that enable you to insert vari...

Windows PowerShell Command Builder for Microsoft SharePoint 2010 and Microsoft Office 365

Windows PowerShell is a command-line scripting tool that provides an administrator full access to applicable application programming interfaces (APIs). Administrators can use Windows PowerShell to interact directly with SharePoint-based web applications, site collections, sites, lists, and much more. The Windows PowerShell Command Builder enables IT professionals and power users to visually assemble commands related to SharePoint 2010 Products and Office 365 on a Design Surface in a browser and take those commands to their respective products. The Windows PowerShell Command Builder provides an intelligent user experience. After you drag a verb or noun object on the Design Surface, the interface will hide either the verbs or nouns that are not associated with the verb or noun placed on the Design Surface. After you construct a command, you can copy the command to Windows PowerShell script, the SharePoint 2010 Management Shell, or other desired location to be saved or execute...