Posts

Showing posts from August, 2014

How to Add new content type to SharePoint Document Library using Powershell

$site = Get-SPSite SiteURL foreach($web in $site.AllWebs){  $listCounter = $web.Lists.Count  for($i=0;$i -le $listCounter;$i++) {  $list = $web.Lists[$i]      if($list.BaseType -eq "DocumentLibrary") {      $newList = $web.Lists.item($list.ID);         $newList.ContentTypesEnabled = $true         $newList.Update()             #Add site content types to the list         $ctToAdd = $site.RootWeb.ContentTypes["New Excel"]         $ct = $newList.ContentTypes.Add($ctToAdd)         write-host "Content type" $ct.Name "added to list" $newList.Title         $ctToAdd = $site.RootWeb.ContentTypes["New PowerPoint"]         $ct = $newList.ContentTypes.Add($ctToAdd)         write-host "Content type" $ct.Name "added to list" $newList.Title         $newList.Update()  }  }  $web.Dispose();      } $site.Dispose();

Enable versions in SharePoint Library using PowerShell

$site = get-spsite("SiteURL") foreach($web in $site.AllWebs) {  Write-Host "Inspecting " $web.Title  foreach ($list in $web.Lists) {  if($list.BaseType -eq "DocumentLibrary") {  $list.EnableVersioning = $true  $list.MajorVersionLimit = 5  $list.Update()  }  } }

Feature Stapling in Sharepoint 2010 & 2013

Image
Feature Stapling  is a concept using which a specific feature will be stapled to site template Scenario I want a custom list to be deleted by default whenever a site is provisioned using the Team Site template. The best way to do this is to create a Feature Stapling. Steps to create  1. Create an Empty SharePoint project 2. Create a new Feature1 3. Add feature event receiver 4. Create a Empty element named "FeatureAssociation" [ add new item] and link the Feature1 by using feature id 5. Create a one more feature to stable this feature name Feature 2. Scope of the Feature is "Web Application" Deploy the solution and go to Central admin and select manage site features and activate our feature1[Name of the feature : Feature Stabler] Now you will create new site collection by using Teamsite template and go to viewall site contents.

Deprecated Features in SharePoint 2013 From SharePoint 2010

Features deprecated in SharePoint 2013 Preview The following features and functionality have been deprecated or changed in SharePoint 2013. Visual upgrade The visual upgrade feature in SharePoint Server 2010 is not available in SharePoint 2013. This allowed site collection owners and site owners to update customizations to work in the new user interface. Once the database and site collection upgrade was complete, the user had the option to upgrade the user interface on a more granular level of the website.  Reasons for removing this feature:  The visual upgrade feature is replaced with a deferred site collection upgrade. The site collection upgrade process is not reversible. The deferred site collection upgrade is a more comprehensive upgrade process than visual upgrade. Visual upgrade preserved only the old master pages, CSS files, and HTML files. Deferred site collection upgrade preserves much more, including SPFeature functionality. To do the deferred site collection upgrade, major

Ghostable and GhostableInLibraqry and UnGhostable ?

When a site is provisioned SharePoint doesn't really copy the pages for that site (i.e. default.aspx,setting.aspx,viewlsts.aspx) into a new database table or directory. These files exist only once on each of the front end web servers(12hive/14hive). Instead SharePoint, creates a reference to those files in the database tables that define the new site. This is called "ghosting".which improves the performance of a site.i.e ghosted pages are filesystem pages. Unghosting means that pages which are present in a database and supported the customization. GhostableInLibrary however specifies that the file be cached as part of a list whose base type is Document Library and that you can work with the file as you would with any other file in the library (check-in, check-out, version history)

SharePoint 2013 and Search with REST API and ODATA

http://www.codetails.com/2013/01/29/sharepoint-2013-and-search-with-rest-api-and-odata/

Chrome Control (Navigation Control) on the Provider Hosted Application to go back to SharePoint Site

Today i have faced one issue. I have submitted my app into microsoft app store unfortunately my app has got rejected due to some reasons. I would like to share one of those reasons here. "Users to navigate back to SharePoint via chrome controls or something similar" the below script needs to be pasted in the starting page of the app. < script src ="../Scripts/msajaxscript.js" type ="text/javascript">     </ script >     < script type ="text/javascript" src ="../Scripts/jquery-1.7.2.min.js">     </ script >     < script type ="text/javascript">         var hostweburl;         // Load the SharePoint resources.         $(document).ready( function () {             // Get the URI decoded app web URL.             hostweburl =                 decodeURIComponent(                     getQueryStringParameter( "SPHostUrl" )             );             //

Managing SharePoint 2013 App Context

Basic Contextual Information Key Description AppQueryString This is the complete encoded query string stripped from the launch URL. This can be attached to subsequent URL links to maintain context if the current browser does not support Session Storage. BaseContextStatus A message indicating the status of the context. Possible values are “undefined”, “success”, or a serialized JSON error object. ContextCreated The timestamp when the current context was created. ContextModified The timestamp when the current contextual information was modified. SenderId The identifier used when requesting an App Part resize with  postMessage . SessionStorageSupport A Boolean value indicating if the current browser supports HTML5 Session Storage. SiteFullUrl The Full URL of the Site Collection hosting the app. SPAppWebUrl The decoded value of the SPAppWebURL query string parameter. SPClientTag The decoded value of the SPClientTag query string parameter.

“Only secure content is displayed” notification in Internet Explorer 9 or later

http://support.microsoft.com/kb/2625928/en-us