Sunday, March 24, 2013

Deploy / Upgrade SharePoint 2010 Solutions in SharePoint 2013


you can continue to use your SharePoint 2010 VS2010 code and customizations inside SharePoint 2013. Most of them should work just fine in SharePoint 2013 because by default SharePoint 2013 supports both 14 Hive and 15 Hive directory structure.

Most of time SharePoint 2010 solution gets deployed to the 14 hive instead of 15 hive, because of a setting in the manifest.xml file. you need to add ‘SharePointVersion=”15.0″’ attribute in manifest.xml file of solution to force the solution to be installed in 15 Hive. Also _layouts folder reference needs to be updated to “_/layouts/15/” to point in 15 hive.

I would suggest to follow these steps for any SharePoint 2010 project to upgrade and deploy in SharePoint 2013 - 
  1. Install Visual Studio 2012 and reopen solution in VS 2012
  2. Change .NET Framework version to  v4.5
  3. Update existing reference of Microsoft.SharePoint.dll to "C:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\ISAPI". (may need to other dlls reference as well)
  4. Add a property ‘SharePointVersion =”15.0"’ in <Solution> element in the manifest file. (otherwise it gets installed into SharePoint 14 location)
  5. Update _layouts folder reference.
  6. Build your solution, deploy and Test.


Hope this helps!

Thursday, March 14, 2013

Open all PDF files in a new browser window


This can be achieved via JQuery. 

To open pdf files in new browser window : 

<script type="text/javascript"> 
$(document).ready(function() { 
$("a[href*=.pdf]").click(function(){ 
window.open(this.href); 
return false; 
}); 
}); 
</script>
 
Or you can use target=”_self” attribute to open new document in the same window : 

<script type="text/javascript"> 
$(document).ready(function() { 
$("a[href*=.pdf]").click(function(){ 
$(this).attr({"target":"_self"}); 
return false; 
});
}); 
</script>
 
Update:- 
If onclick attribute is present then try this  
$("a[href$='.pdf']").removeAttr('onclick').attr("target","_blank"); 

Hope this helps.