Navigation Bar

Showing posts with label Microsoft SharePoint 2007. Show all posts
Showing posts with label Microsoft SharePoint 2007. Show all posts

Sunday, 1 July 2012

Debugging SharePoint code in Production


Recently I was asked to troubleshoot production code. Unfortunately we did not have pre-prod or staging environment.

In production, you have to be very careful. You can’t deploy anything without going through some checks (or build pipeline).
Then what I did was very simple thing. Imagine what would have I done!!!
I chose a SharePoint layout page that only displays links. Guess which page it was? Yes it was _layouts\settings.aspx page.
I copied _\layouts\settings.aspx to _layouts\Masood\settings.aspx and modified with my debugging code.
I wrote code in scriptlet.
<%
Response.Write(“Beginning of my debugging code...”);
YourDependencyClass obj = new YourDependencyClass();
obj.SomeMethod();
%>
The other thing I did was I wrote whole classes between< % and %> and fortunately I found the issue. Following is an example

< %
public class YourDependencyClass {
   public void SomeMethod(){
          //your logic…
   }
}%>
I hope that will work for you if you need to do troubleshoot in production environment.

Wednesday, 13 July 2011

Showing search results in xml

Some time we need to cutomize search results via XSLT. To customize the search results, we need to display the results in xml.

Here is the xsl you can use in xsl property of search result core webpart to show the results in xml:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:template match="/">
<xmp>
<xsl:copy-of select="*"/>
</xmp>
</xsl:template>
</xsl:stylesheet>

once you apply the property, you need to research to get the results in xml and write your XSL according to given xml to customize the search result page.

Enjoy customizing search results :)