Sharepoint Insight by Namwar Rizvi

Sharepoint Tips, Tricks and inside knowledge from real world experience by Namwar Rizvi

Archive for September, 2008

Update List Item without changing Modified By and Modified fields

Posted by namwar on September 30, 2008


If you update a field of a SPListItem obeject from code by using the following code snippet

item[“Title”]=”Updated Title”;

item.Update();

then you will notice that Modified By  and Modified field will be updated also. Sometimes, you just want to update fields without changing Modified By and Modified fields, you can do so by using 

item.SystemUpdate();

instead of item.Update();

SystemUpdate() method just updates the intended field values.

Advertisements

Posted in Object Model | Tagged: , , | Leave a Comment »

How to check if the file is indexed in SharePoint or not?

Posted by namwar on September 17, 2008


If you want to know whether your file is indexed in Sharepoint Search Services Provider (SSP) or not then there is no way provided directly in the object model of SSP.

Since Sharepoint stores its content on SQL Server therfore, you can run the following TSQL query to find it:

Select * from dbo.MSSAnchorText where Link='<Your File Path>'
Note: Please note you need to replace <Your File Path> by the full path of the your intended file in the above query
Example
Select * from dbo.MSSAnchorText where Link='http://mossdev/Shared%20Documents/UserManual.pdf'

Posted in Object Model, SSP | Tagged: , , , , | Leave a Comment »

How to get raw XML of Sharepoint Search Core Results Web Part?

Posted by namwar on September 12, 2008


If you are like me and trying to customize the search result presentation in SharePoint then you must have faced the issue of customizing the XSL of Sharepoint Search Core Results Web Part. You can customize the XSL by using SharePoint Designer or any other WYSIWYG XSL editor, if you know the raw XML returned by Search.

To get the raw XML click XSL Editor button of Search Core Results web part and replace the already provided XSL with the following

<xsl:stylesheet version=”1.0″ xmlns:xsl=”http://www.w3.org/1999/XSL/Transform&#8221; >

<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>

Posted in Customization | Tagged: , , , | Leave a Comment »

How to remove or Extend New! Item tag for Sharepoint List Items

Posted by namwar on September 7, 2008


Whenever you add a new item in any Sharepoint list “New!” item tag displays against that item for a time being. The time to display this tag depends on a property called “Days to Show New Icon”. The value of this property determines the number of days to display the New! tag against an item.

If you set this property to zero then newly added items will not have this tag. On the other hand if you want to display this tag to be displayed longer then usual then you can set its property in number of days as per your requirement.

Following is the step-by-step procedure to do that:

  1. Click Start, point to All Programs, point to Accessories, and then click Command Prompt
  2. Type the following commands, and then press ENTER after each command:
    cd /d %programfiles%\Common Files\Microsoft Shared\Web Server Extensions\12\BIN
     stsadm.exe -o setproperty -pn days-to-show-new-icon -pv 0 -url [Your Virtual Server’s URL]

Posted in Configuration, Management | Tagged: , | 1 Comment »