Date format is not correct in the DataFormWebPart SharePoint 2010

Ok there is some problem when formatting date’s which is different than US format when using XsltListViewWebPart has defined by Microsoft. This happens because the ddwrt:FormatDate function expects the data format to be in UTC and the XSLTListViewWebPart returns the date preformatted to the Web Locale or Locale Date/Time .

To fixing this issue Microsoft has released a new feature ,A new Property, EnableOriginalValue, has been added to the XlstListViewWebPart that unblocks this scenario by February CU 2012.

You can check fallowing article for more information:
http://support.microsoft.com/kb/2580994

For DataFormWebPart;the option is to use the DataFormWebPart with the following property set to false on the <SPDataSource> tag: UseServerDataFormat.
Make UseServerDataFormat property set to false the DataFormWebPart will receive the Date/Time in UTC format and then the ddwrt:FormatDate function will work accurately.

Or you can use power of xslt to format date as you wish:
Fallowing example will help you to how to do it.

Add fallowing codes in DataFormWebPart for suitable place for xsl:template

<xsl:template name=”FormatCorrectDate”>
<xsl:param name=”dateValue” />
<xsl:param name=”monthFormat” />

<!– Sperater is important here it should be “.” or “/” according your current language settings –>
<xsl:variable name=”day” select=”substring-before($dateValue, ‘.’)” />
<xsl:variable name=”month” select=”substring(substring-after($dateValue, ‘.’), 1, 2)” />
<xsl:variable name=”year” select=”substring(substring-after(substring-after($dateValue, ‘.’), ‘.’), 1, 4)” />

<!– Create US Date Format –>
<xsl:variable name=”USDate”>
<xsl:value-of select=”$month” />/<xsl:value-of select=”$day” />/<xsl:value-of select=”$year” />
</xsl:variable>

<!– Month Notation –>
<xsl:variable name=”monthString”>
<xsl:choose>
<xsl:when test=”$monthFormat=’M1′”>
<xsl:value-of select=”$month” />
</xsl:when>

<xsl:when test=”$monthFormat=’M2′”>
<xsl:value-of select=”ddwrt:FormatDateTime(string($USDate), 1055, ‘MMM’)” />
</xsl:when>
<xsl:otherwise>
<xsl:value-of select=”ddwrt:FormatDateTime(string($USDate), 1055, ‘MMMM’)” />
</xsl:otherwise>

</xsl:choose>
</xsl:variable>

<!– Create Date –>
<xsl:choose>
<xsl:when
test=”string-length($day) = 1″>0</xsl:when>
</xsl:choose>

<xsl:value-of select=”$day” />-<xsl:value-of select=”$monthString” />-<xsl:value-of select=”$year” />
</xsl:template>

Call formatting template where you can needed in code :

<xsl:call-template name=”FormatCorrectDate”>
<xsl:with-param name=”dateValue” select=”string(@Created)” />
<xsl:with-param name=”monthFormat”>M2</xsl:with-param>
</xsl:call-template>

Resources:
https://www.nothingbutsharepoint.com/sites/eusp/Pages/Bug-With-SharePoint-2010-XSLT-DateFormat-Function.aspx
http://social.msdn.microsoft.com/forums/en-US/sharepointcustomization/thread/7a636804-1ff1-4bb8-8bcd-9ef713d15680
http://support.microsoft.com/kb/2580994

Import ULS log files to SQL Server database for Sharepoint 2010

Sometime you may need to import ULS log files to SQL server . It can be done with several ways by using SQL Server import tools or import from an Excel file to SQL  server. Or you can use fallowing free open source windows application tool. With this tool it can be done with more quickly . By multy-threading and bulk insert architecture feature provides you that ULS logs contains total 1.500.000 row  can be upload in  apprx. 2 minutes. (as you know it depends on your configuration and hardware)

Than you can query SQL tables as you wish : Fallowing query will return execution time over 1 sec for SPMonitoring event records.

select * from WFE1
where [ExecutionTime] > 1000 and [Eventid] =’b4ly’
order by [ExecutionTime] desc

“All These source codes are freeware and is provided on an “as is” basis without warranties of any kind, whether express or implied, including without limitation warranties that the code is free of defect, fit for a particular purpose or non-infringing. The entire risk as to the quality and performance of the code is with the end user

For Download  ULStoSQLImporter v1.0  for Sharepoint 2010:
http://spstools.codeplex.com/releases/view/93135

How to collect IIS Logs for a SharePoint Web Application

Hello All,

When working with Microsoft Support for some cases the support engineers ( like me ) may request IIS Logs for investigation.
So in this article i am going to tell how you can collect IIS Logs correctly.

1) You have to detect your IIS Web site on IIS Console because your site url and your web application name can be different.
First connect your Central Administration and click “Managed Web Application”‘s link .

but my Web Application Name is SharePoint – 8080

2) Open your IIS Manager and find and click your webapplication name

3) Click the “Advanced Settings” in Action pane.

4) Please not your IISsite ID for this example is 1442344892

5) Click “Logging” icon

6) Detect where the IIS logs are kept in which folder

7) Open this folder in Windows Explorer and find your related folder in it according your IISSite ID. In this scenario the folder is W3SVC1442344892
You can open windows explorer by “Start” -> “Run” and copy paste highlighted path on above screenshot and press enter.

8) Open that folder and order by “Modified Date” as descending order

9) Collect your files according to occurrance time of your problem or issue. If you have a workspace opened by Microsoft and your file size are big , you can compress the files with a compression program.

Notes: IIS buffers the logs in memory for a while before write to the log file (until log buffer chuck size has reached its max size). If you want to catch latest records you may need to do an iisreset or open a command prompt and type  “netsh http flush logbuffer” (this command will provide http.sys to flush logs.)
to force iis write cached log chunk to log file. If you are searching for old records that “Modifed Date” earlier than last log date you dont need this operation.

Have a nice log hunting 🙂

SharePoint 2010 restoring content database manually from sharepoint backup folder

Hello Everyone ,

In this article i am going to tell you how could you extract and restore a specific content database from backed up Sharepoint Full-Farm backup.
First lets have look our target content database which we want to restore . In my example the database name is “WSS_Content_5050” .

1) Open your Sharepoint Full Farm Backup folder. If you don’t know the backup folder  you can find  from Central Administration web site.

2) As you noticed when we order items by size in Sharepoint Full-Backup folder ( “spdbr0000”) you can see the biggest files . That files as usually  SQL backup files of sharepoint databases but which file is our content database ?

3) If you order items by Type you can find the file which we are looking for  named “spbackup.xml” .this file our backups index file in xml format.

4) than open this xml file in any editor and search your content database name in this file .

5) as you notices that “0000012A.Bak file . This is our content database’s backup file.
6) Copy this file to your SQL Server and now you can restore this file (if it is not corrupted)   via Sql Server Management Studio .

Misunderstanding when upgrade Sharepoint Server 2010 SP1 with Language Service Packs KB2460059 vs KB2460056

As you know we have installation setup for language pack 2010 Service Pack 1

1) Service Pack 1 for Microsoft SharePoint Foundation (MSF) 2010 Language Pack (KB2460059)
http://www.microsoft.com/download/en/details.aspx?id=26629

2) Service Pack 1 for Microsoft SharePoint  Server (SPS) Language Pack 2010 (KB2460056)
http://www.microsoft.com/download/en/details.aspx?id=26621

Some of the articles in internet tell us install MSF Language service pack1 first KB2460059 and than install KB2460056 after.
THAT IS NOT CORRECT !!!
If you fallow this order  ,you can easily detect that you can not able install KB2460056  after KB2460059 .

First of all the KB2460056 contains all packs for KB2460059.

That’s why if you have Sharepoint Server 2010 you should install only  Service Pack 1 for Service Pack 1 for Server Language Pack 2010 (KB2460056) or
if you have Sharepoint Foundation 2010 you should install only  Service Pack 1 for Microsoft SharePoint Foundation 2010 Language Pack (KB2460059)

For prove this i have download Turkish SPS and MSF Language Service Pack1 and extract the packages and compre them.

Service Pack 1 for Microsoft SharePoint Foundation (MSF) 2010 Language Pack (KB2460059)
spflanguagepack2010sp1-kb2460059-x64-fullfile-tr-tr.exe

Service Pack 1 for Microsoft SharePoint  Server (SPS) Language Pack 2010 (KB2460056)
serverlanguagepack2010sp1-kb2460056-x64-fullfile-tr-tr.exe