Possible SharePoint Designer bug – another reason to NEVER customize pages!

Today I spent a lot of time troubleshooting an issue regarding some adjustments to my custom xsl.

As you can see from thousand of posts, be VERY CAREFUL using SharePoint Designer.

As a best practice you should never use SPD in Productive Sites especially avoid customizing pages!.

Great post that explain what customizing (in SharePoint V4, called unghosting) means:


Being aware of that, I’ve never used it, but today (using SharePoint Designer 2010) I discovered another “side effect” using it on Development environment also.

  1. Deploy a file via Solution and add it to a Document Library via Feature (e.g. the file dummy.xsl in /Style Library)
  2. Customize it via SharePoint Designer (to quickly edit or fix it) and check-in
  3. revert to uncustomized version (via SharePoint Designer “Reset to site definition”)
  4. Update the corrected/fixed file with a Solution

You are quite comfortable that performing steps 3 and 4, all it’s ok and eliminates any side effect of having customized the file. Correct? No, unfortunately.

From that time on, you have this strange behavior:

  • Accessing the file using the browser (or referring that file in your webparts), the version you are using is the “right” version (that one deployed with step 4)
  • Re-accessing the file via SharePoint Designer, will return the customized version (that one modified with step 2), altough the file property “Customization Status” indicates that you are using the “site definition version” (uncustomized version) . Then, if you need to rework this file, you are in trouble because you aren’t working on the “last” uncustomized version (deployed at step 4), but the version that you previously customized with SharePoint Designer (step 2)!!!!!

Only by deactivating and reactivating the Feature that provision dummy.xsl (the deactivation deletes the file and all its versions), SharePoint Designer takes the corret version.

Be aware that some files (e.g. Page Layouts) cannot be deleted by deactivating the related Feature (because, as the example, they are used in all Publishing Pages derived from that Page Layout); In these cases you cannot (as I know) completely revert the file version to the step 4 (via SharePoint Designer, that will continue to see the version created at step 2)!

At the end of this story, another reason to:

NEVER, NEVER, NEVER customize files using SharePoint Designer in your productive environment (or be aware of the possible side effects)

And, as for me, if your development lifecycle requires working with SharePoint Designer, package the file, provision via solution/feature, correct this file with SPD, repackage, (.and so on…) be aware of that.

Posted in Development, Ghosting/Unghosting, SharePoint Designer | Leave a comment

Biztalk Adapter Pack – Microsoft SAP Integration made simple

BizTalk Adapter Pack (as of December 2011, current version is 3.0) is one valuable option to enable interoperability between Microsoft & SAP (and other LOB, not discussed here, such as SQL Server remote data, Oracle DB and ERP, Siebel), by using in this implementation SAP specific protocols and formats (IDOC/RFC).

It’s based on the WCF LOB Adapter SDK, at which basis there is WCF, properly extended to support a wide range of foreing applications.

LOB Adapter

The “main”component of this product is the LOB adapter, that enables data exchange in bi-directional way (sending/receiving IDOCs to/from SAP).

More info at: http://technet.microsoft.com/en-us/library/bb798126.aspx

The Adapter was a stand-alone product (http://www.microsoft.com/biztalk/en/us/adapter-pack-pricing.aspx) but, on the current version (end 2011, version 3.0) is completely integrated (on licensing and packaging side) in Biztalk 2010 (http://www.microsoft.com/biztalk/en/us/adapter-pack.aspx); it means that, in order to buy and use the Adapter, you should buy Biztalk 2010 (standard, or Enterprise editions).

The deployment however is independent; you can install (and use) the LOB Adapter only, without making an BizTalk installation (losing, obviously, the ability to use the Adapter within BizTalk).

The online documentation (available at: http://msdn.microsoft.com/en-us/library/dd787879.aspx) includes some interesting tutorial samples integration scenarios:

  • Tutorial 1: Presenting Data from an SAP System on a SharePoint Site
  • Tutorial 2: Migrating an SAP RFC BizTalk Project
  • Tutorial 3: Migrating an SAP Send IDOC BizTalk Project
  • Tutorial 4: Migrating an SAP Receive IDOC BizTalk Project

DATA Adapter

BizTalk Adapter Pack ships with another interesting component, called Microsoft .NET Data provider for mySAP Business Suite (http://msdn.microsoft.com/en-us/library/dd787931.aspx), that extends the ADO.NET interfaces to support accessing SAP (and other LOB applications) data.

(NOTE: Do not confuse this implementation with the preview available in SQL 2005 Feature Pack; the latter is free, but is a preview and then unsuported (you use it, it works, with some limitation, but  don’t expect to receive support!).

It allows you to invoke queries against the SAP Application Server layer, so you can access (=select) data by passing through the SAP Data Dictionary

It means you can access almost 100% SAP tables decoupling the technology on which SAP is running on (since the connection is made at the Application level by using SAP protocol RFC),

Please, consider that accessing SAP tables through the RDBMS is not supported, not 100% possible (e.g. POOL/CLUSTER tables) and can violate the licensing usage of the DB runtime.

HOW does it work:

On SAP Side it is built on 2 Function Modules/RFC-enabled:

  • Z_EXTRACT_DATA_OO –> lets you to execute SELECT statements on SAP dictionary  tables/views objects (invoked on AS-layer, passing through the SAP data dictionary)
  •  Z_EXECUTE_SAP_QUERY –> lets you acces to SAP queries (internally executes RSAQ_REMOTE_QUERY_CALL)

how to install them (SAP-side): http://msdn.microsoft.com/en-us/library/dd788547.aspx

Using Biztalk Adapter Pack (LOB and DATA adapters)

On the .NET application side, you have to install the librfc32 library toghether with all the required client libraries.

You can invoke these adapter by using a wide range of development (and configuration-oriented) tools, such as:

  • Using the Class libraries directly in your own code (using WCF service/channel model) invoking/listening (t)RFC (the latter allows you to develop and RFC server program!), invoking BAPI, sending/receiving IDOCs
  • Using BizTalk Server to perform all the above mentioned operations
  • Using ADO.NET to invoke RFC, BAPI, and SELECT operations inside you own code, by using SSIS (Integration Services), or SSRS (Reporting Services).

Complete reference is here: http://msdn.microsoft.com/en-us/library/dd788621.aspx

Posted in SAP Interoperability | Leave a comment

Favicon in SharePoint

What is the favicon?

As the name suggests, it’s simply a picture file (icon with .ico extension) joined to a site’s URL. Most professional sites use the favicon in order to enforce site’s branding, and make all shortcuts to their websites distinguishable.

You can find the favicon in the corner of the address bar of your browser (just before the URL of the site you are exploring). It’s an .ico file, 16×16 pixels. Below you can see the “WordPress” favicon picture:

Creating the favicon

Great online resource helping to generate favicon .ico (16×16 pixels): http://www.favicon.cc

You can create the favicon from scratch or starting by an existing image.

Embedding favicon in SharePoint

The best way to integrate Favicon in SharePoint (and make it available globally on your site) is to embed this resource in your custom Master Page.

By using SharePoint V3 technologies (SharePoint Services V3 or MOSS 2007)

<head runat=”server”>
 <!– favicon –>
 <link rel=”shortcut icon” href=”<% $SPUrl:~sitecollection/Style%20Library/Custom/LayoutResources/Images/favicon/favicon.ico %> />

NOTE: By using “$SPUrl:~sitecollection” is useful since it always refers to the site collection place (root web) regardless the hierarchy position of the sitecollection itself, and allowing to create a very “generic” and reusable master page. The downside is that it’s only permitted with MOSS (not with SharePoint Services)



If you are using SharePoint V4 technologies (SharePoint Foundation V4 or Server 2010), other than the above solution (still possible), yuo can take the advantage of SPShortcutIcon class (Server Control).

 <!– favicon –>
<SharePoint:SPShortcutIcon runat=”server” IconUrl=”<% $SPUrl:~sitecollection/Style%20Library/Custom/LayoutResources/Images/favicon/favicon.ico %>“/>
Unfortunately (trust me), using this server control referring to “$SPUrl” doesn’t work; it just emits a compile error (cannot cast “System.String” to “System.Uri”), exactly as described in the Joel’s blog: http://joelblogs.co.uk/2010/11/09/sharepoint-2010-favorites-icons-favicons-and-spurl-spurlexpressionbuilder/
  1. Use V3 approach
  2. Apply the Joel’s suggestion (creating an ASP:Literal to dynamically build a correct path)
  3. Place the icon resource on the filesystem (possible, but not recommended by Microsoft), instead of placing it in an assets Document Library (such as “Style Library”) and referring to it by a fixed directory (such as /_layouts)
Hope this help to design a more professional website.
Posted in Branding | Leave a comment

How SharePoint knows about Central Config Database

Have you ever asked yourself how SharePoint, during startup, can connect to its Config Database allowing starting its activity?

Thanks to this post (http://www.facebook.com/note.php?note_id=395920636450) the answer:

the registry key “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Shared Tools\Web Server Extensions\12.0\Secure\ConfigDb” contains the DSN string in order to connect to the Config Database.

Posted in Infrastructure, SharePoint DB | Leave a comment

Moving Databases between SharePoint 2010 Farms

What about moving SharePoint databases between SQL Server Instances? Quite simple, nice articles around the Internet, but I discovered some issues that I’m glad to share!

SharePoint Databases are of 3 categories

  1. Configuration DB
  2. Content DB (your data)
  3. Service Applications DB

 You can use this article as a starting point: http://technet.microsoft.com/en-us/library/cc512725.aspx

 Basically this article instruct you to:

  • Prepare the target DB Server (recreate/copy logins)
  • Isolate the source DB Server/detach DB
  • Attach DB to the new DB Server
  • relink SharePoint to new DB Server (via SQL Alias)
  • Restart opeorations on new DB Server


 However, after doing these steps, I noticed some errors in the Event viewer Application log, and in SharePoint trace logs

Problem 1

The first error in the Event Viewer says “The user does not have permission to perform this action”. After investigating in trace logs, I discovered the action causing the error: an SQL statement (System.Data.SqlClient.SqlException…)!

I then isolated the SQL statement:

DECLARE @LastExecutionTime datetime
SET @LastExecutionTime = DATEADD(HOUR, DATEDIFF(HOUR, GetUTCDate(), GetDate()), ’11/09/2010 21:46:15′) SELECT db_name(lw.resource_database_id) AS [Database_Name], lw.resource_type AS [Resource_Type], (CASE WHEN lw.resource_type = ‘OBJECT’ THEN object_name(lw.resource_associated_entity_id,lw.resource_database_id) WHEN lw.resource_type IN (‘DATABASE’, ‘FILE’, ‘METADATA’) THEN db_name(lw.resource_database_id) WHEN lw.resource_type IN (‘KEY’, ‘PAGE’, ‘RID’) THEN lw.resource_description ELSE ‘?’ END) AS Resource_Name, lw.request_mode as Wait_Mode, lb.request_mode as Block_Mode, wait_req.wait_time AS [Waiting_Time], DATEADD(HOUR, DATEDIFF(HOUR, GetDate(), GetUTCDate()), wait_req.start_time) AS [Last_Execution_Time], wait_req.session_id AS [Waiting_Sid], block_req.session_id AS [Blocking_Sid], block_req.blocking_session_id AS [Blocking_Blocker_Sid], block_sess.login_name AS [Blocking_User_Name], block_sess.host_name AS [Blocking_Machine], block_sess.host_process_id AS [Blocking_Process_Id], block_req.statement_start_offset as [Blocking_Statement_Start], block_req.statement_end_offset as [Blocking_Statement_End], wait_req.statement_start_offset as [Waiting_Statement_Start], wait_req.statement_end_offset as [Waiting_Statement_End], block_text.text as [Blocking_Query_Text], wait_text.text as [Waiting_Query_Text] FROM sys.dm_tran_locks as lw (NOLOCK) INNER JOIN sys.dm_os_waiting_tasks as tasks (NOLOCK) ON lw.lock_owner_address = tasks.resource_address INNER JOIN sys.dm_exec_requests AS wait_req (NOLOCK) ON lw.request_session_id = wait_req.session_id INNER JOIN sys.dm_exec_requests AS block_req (NOLOCK) ON tasks.blocking_session_id = block_req.session_id INNER JOIN sys.dm_tran_locks as lb (NOLOCK) ON lb.request_session_id = block_req.session_id AND lb.resource_type = lw.resource_type AND lb.resource_associated_entity_id = lw.resource_associated_entity_id AND lb.resource_description = lw.resource_description INNER JOIN sys.dm_exec_sessions AS block_sess (NOLOCK) ON block_req.session_id = block_sess.session_id  CROSS APPLY sys.dm_exec_sql_text(block_req.sql_handle) AS block_text CROSS APPLY sys.dm_exec_sql_text(wait_req.sql_handle) AS wait_text WHERE wait_req.wait_time > 500 AND wait_req.start_time > @LastExecutionTime  ORDER BY  wait_req.wait_time DESC

I executed it (in SQL query), by using my SPsvcADMIN user (assigned to Central Admin App Pool) and i received the same error 

So, comparing permission on the source SQL and the newly installed SQL (target), I discovered a difference:

As you can see, on the Server properties –> Permissions, a permission for SPsvcADMIN was missing. Granted the above permission the problem disappeared!

Problem 2

Another problem I found (in the Trace logs) was that the Databases I moved do not have the attribute Broker Enabled (required by SharePoint); I simply set, on all databases, the attribute to true. By restarting IIS & SharePoint Services the problem disappeared.

Standard docuemntation requires SErvice Broker enabled for Web Analytics databases only, but for my experience i’ts required for all other DB!

Posted in Infrastructure, SharePoint DB | 1 Comment

Hello world SharePoint 360!

About this blog

This Blog is around SharePoint deployment and development. Of course the product is very powerful and too rich of feature so that discovering it at 360 degrees is impossible, but I want to contribute to the huge amount of information out there, providing tips and issues that, day by day, I have to work with.

Working with the Internet

Who of you, developer, or IT architect, do not rely on the Internet to solve quickly day-by-day problems every day? During my professional activity, as a developer or architecture specialist, I query very often the Internet to discover tricks & shortcut (or simply better understand what’s happening under the hood…) to speed up my job, so thanks to all people who, day by day, contribute with me by speeding up my work and creating a huge shared knowledge about this topic. So, I’m pleased to share my experience too!

I’m an Italian guy, so why writing in English? I saw some very interesting posts in Italian, ok for me, but…does it really help a “colleague” needing help on the other side of the world? …Some very interesting posts in russian….not suitable to me (..and for other 3-4 billion people around the world). So sorry for likely misspelling errors, but I hope to help you, everywhere you are…

Thank you reading I hope it help!

Posted in Uncategorized