Monday, July 11, 2011

WPF: XP style for Ribbon application without title bar

Those who decided to use MS WPF Ribbon probably knows that it has an ugly W98 style on Windows XP.

I have found a solution that works for me.
I decided to use Window instead of RibbonWindow for the application, but in this case it has a title bar:


Finally I've found the following post with example how to hide the bar:
http://blogs.msdn.com/b/wpf/archive/2010/08/20/ribbon-browser-application-without-the-title-row.aspx
It's written for the ribbon browser application but it also works for window application.

In comment to the post I've found the easiest way to hide the bar by changing only .xaml file without modifying .cs.
Just add negative margin to the Ribbon control:
Margin = 0,-26,0,0
It will result the following:

Wednesday, July 6, 2011

WIX: Sleep between Custom Actions during installation

If you require to pause your installation between some custom actions, you can use the following:
<Property Id="QtExecDeferred" Value='"ping" -n 15 127.0.0.1'/><CustomAction Id="QtExecDeferred" BinaryKey="WixCA" DllEntry="CAQuietExec" Execute="deferred" Return="check" Impersonate="no"/>
The QtExec allows to run command line silently.

WIX: How to run Command Line silently

WIX provides a Custom Action that allows to run Command line silently - Quiet Execution Custom Action

You should use it exactly the same way as listed in the WIX example. Just put your command in the Properties value.

<Property Id="QtExecCmdLine" Value='"command" parameters'/><CustomAction Id="QtExecExample" BinaryKey="WixCA" DllEntry="CAQuietExec" Execute="immediate" Return="check"/>

Make sure the command has double quotes. For example: '"ping" -n 15 127.0.0.1'

Don't forget to add the WixUtilExtension extension during building the msi package.

Farm Admin in SharePoint 2010

When you add a user into Farm Administrators group in SharePoint 2007 it automatically added as db_owner for the config database. So, I assumed SP2010 works the same way, but it does not.

When you add a user into Farm Administrators group it is automatically added into WSS_ADMIN_WPG group only. 

Refer to the following article to find out which permissions the group has.
In few words it has permissions to system folders on the SP server.
The account does not have direct access to SQL databases, so there will be problems for any third party tools which work with SharePoint through API

The difference is that when you're working with SharePoint via Central Administration you're actually working with databases under Application Pool account. But when you're working via API (SharePoint Object Model for example) you're working in the context of the account executing API calls. So, to get the API calls working you should grant direct access to SharePoint databases.


If you do not want to grant direct access to configuration database you can use PowerShell command:
Add-SPShellAdmin –username <String>
The command adds the user to the SharePoint_Shell_Access role. In fact, those users who included in the role have db_owner access to the Configuration database.
To get a list of users included into the group execute the following comm and:
Get-SPShellAdmin
Refer to the following article for details about required permissions to run PowerShell.
Refer to the following article for details about the SharePoint_Shell_Access role.

Also if you receive the error message when using STSADM, that may mean you run it under a Farm Administrator user who does not have direct access to SP databases. The error message is the following:

This operation can be performed only on a computer that is joined to a server farm by users who have permissions in SQL Server to read from the configuration database. To connect this server to the server farm, use the SharePoint Products Configuration Wizard, located on the Start menu in Microsoft SharePoint 2010 Products.