Posts

Showing posts from February, 2014

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){ ...

PowerShell scripts for Updating content types and Page Layouts in Page

In this blog we are going see how to change page layout and content type of publishing pages in document library using PowerShell script. Page Layout and Content Type Page layout is a publishing feature that defines the layout of a page. So we need to import the Microsoft.SharePoint.Publishing.dll into PowerShell. Then follow these steps: Get the object of PublishingWeb from SPWeb. $publishingWeb = [Microsoft.SharePoint.Publishing.PublishingWeb]::GetPublishingWeb($web);   Get the object of page layout from then title of page layout. $allPageLayouts = $publishingWeb.GetAvailablePageLayouts(); $pageLayout = $null; foreach($pl in $allPageLayouts){     if($pl.Title -eq $NewPageLayout){         $pageLayout = $pl;         break;     } }   Then get the object of publishing page object using page url and publishing web object. $page = $pu...