U2U Blog

for developers and other creative minds

SQL Server 2008 Declarative Management Framework: be careful with subscriptions

Before we get to the bad part, I first want to stress the importance of the new declarative management framework (DMF). It allows administrators to define policies (naming conventions, security settings, force index creation, avoid fragmented data,...) and then map these policies onto servers or databases. This will simplify the administration of a SQL server instance a lot! For more info, check e.g. this webcast.

Now for the bad news. Policies are grouped into policy groups (quite straight forward), and a database subscribes to zero, one or more policy groups. However, when we drop a database, the subscriptions are not dropped. This can cause some very nasty side effects:

  • When dropping a subscription group, this operation can fail because of a subscription by a database you dropped already a while ago. In this case, manually dropping the subscriptions will solve the problem.
  • Imagine you drop a database X which subscribed to a bunch of policies. Some months later you create a new database which accidently has the same name X. Then automatically all policies which applied to your old database X will now also apply to your new database X: Mapping happens on database name, not id!

What do we do about this? This behaviour is in the July CTP, maybe next releases will no longer suffer from this problem (vote for the bug report here). Else, the solution is to manually clean up these subscriptions. In the msdb database, you find a view syspolicy_policy_group_subscriptions and a stored procedure sp_syspolicy_delete_policy_group_subscription with wich you can manually fix all problems.

Nico

SharePoint is not the Holy Grail

The last couple of weeks there has been some turmoil in the world of SharePoint with a couple of postings (like this recent one) arguing that SharePoint is not really a good solution for companies. It is interesting to read these stories and even more interesting to read the passionate comments of both the pro- as well as the anti-SharePoint visitors.

I have been talking about this quite a number of times the last months trying to explain to people the following:

  • SharePoint is not the holy grail. In some companies I visit, management has the assumption that introducing SharePoint will solve all of the problems with regard to collaboration, enterprise content management, search, business intelligence and more. This is of course not true. SharePoint is not the holy grail. It is an enabler for delivering excellent solutions that will increase the productivity of the individual information workers, the teams and the enterprise. I agree with the already mentioned posting, an organization that does not have these processes worked out before introducing SharePoint will likely fail and has no right to blame SharePoint for this failure.
  • SharePoint is a development platform. For me (and many other people), WSS is your development platform for building solutions for the information worker. MOSS is an extension of that platform with new APIs and new services that aim at delivering more enterprise-wide solutions. If you think that the out-of-the-box experience with both WSS and MOSS will solve your problems (and then we are again talking about the holy grail misconception), then you'll fail. I see great usage of SharePoint within companies that have made the switch. SharePoint is ASP.NET++. ASP.NET is a great framework that is used all over the world to build powerful and rich Web applications (both internal and external). WSS and MOSS add to this layer more object models, more infrastructural pieces and more services that developers can use to build more dynamic, people-oriented type of applications. And these solutions are build in the same way as other software. It requires a bit more discipline, but SharePoint developers can leverage all of the unit testing, source control, and other pieces that support a professional, enterprise-level software development cycle. Anyone who thinks differently, should really start reading books like the one my buddy Ted Pattison has written.
  • SharePoint is not easy. I would not say complex because that has a negative sound to it. Since SharePoint is a platform (you can also compare it to an operating system - see it as a virtual file system stored in a database), you have an infrastructure that is very often quite overwhelming in the beginning. It reminds me of the early days of the Windows operating systems. They were regarded as complex too. But over the years, even my mother and father are able to share pictures using their Windows Vista Home edition. Things have become easier. Why? Developers have build ready-to-be-used solutions on top of this. Building these solutions is by no means easy, often a challenge, but over the years it has improved considerably. This will happen with SharePoint too. I know the product teams in Redmond are making a lot of efforts to make SharePoint a better development platform, easier to program against, more tools and better support within the professional development environment of the .NET developer. SharePoint is not only difficult for developers, it is also difficult for the administrators and can be difficult for the users. However, administrators very often get the task of maintaining, configuring SharePoint farms as one more additional task on top of what they have as daily tasks. WSS and MOSS are complicated server-side infrastructural pieces that need to managed like you manage other server-side platforms and services (like DNS, firewalls, networking in general, Active Directory). Proper training and more dedicated SharePoint administrators will be beneficial here. The same for the users. If you simply drop SharePoint as something to be used within the organization, you'll fail. Users need training, just like they need training to work efficiently in the Office products or any other software. You can achieve a level without training but a one to two day training (in whatever form) will change the perception of the users and they will be more productive in utilizing what's there in SharePoint.
  • SharePoint is about building or buying. Yes, SharePoint is a platform. You get powerful APIs for supporting collaboration, document management, content management, records management, document conversions, information management policies, reporting, dashboards, and I can name 15 other types of APIs that are there. Small OOB Features give an impression of what these can do for you. But dudes... if you want to go forward you either have a bunch of dedicated SharePoint developers or you buy. You want workflow? Build or buy stuff like K2, Nintex, Captaris, ... You want records and compliance management? Build or buy stuff like Meridio. You want better search experience? Build or buy stuff like Ontolica Search. You want better offline experience? Build or buy stuff like Colligo. And I could go on here a bit more. Microsoft delivered the platform. Partners and in-house developers build the solutions on top of it. If you don't get that message, then you are back to the holy grail misconception.

I am sure that not everybody agrees with the above. But for me this is the reality and thinking about SharePoint this way makes it easier to accept the many holes and missing things we currently have in SharePoint. You know that you can always build something that will help filling these holes. Is it easy? No way. Is building extensions for the Windows Explorer easy?

Now if you are coming to TechEd Barcelona, Ted and I are hosting two chalk-talks (or interactive theaters as they are called now I think) on all of this:

Best Practices for Developing, Deploying and Maintaining SharePoint Solutions - Q&A (OFF01-IS) - 7 November 2007 Start: 10:45 Finish: 12:00 Room: Room 133

Ted Pattison and Patrick Tisseghem have worked the last 3 years very closely with the SharePoint product team to write and deliver course material targeting a developer audience who want to learn the best ways of building and deploying SharePoint solutions. In this session you’ll have the chance to engage with them in question and answer conversations regarding all of this.
Topics we can discuss are:

  • The best way to set up your development environment.
  • Working with Features.
  • Visual Studio Extensions for WSS 3.0.
  • Construction of SharePoint Solutions.
  • Deployment options.
  • The various scenarios for maintaining solutions that are in production.

SharePoint – the How’s, Why’s, When’s and What’s for Successful Development and Deployment (OFF08-IS) - 8 November 2007 Start: 15:45 Finish: 17:00 Room: Room 116

Join this Interactive Discussion if you are looking for answers to questions like:

  • "When is it appropriate to use SharePoint within an organization?"
  • "What are the weak and strong points of SharePoint?"
  • "What are the pitfalls?"
  • "What kind of resources do I need, the level of infrastructure and also people (both administrators as well as designers and developers)?"
  • "What are the options to make SharePoint do what why business wants it to do?"
  • "What effort is that going to take?"
There are of course plenty of other related questions that can be discussed during this session. Ted Pattison and Patrick Tisseghem will be more than happy to share their experience during the interactive discussion. The session is planned to be high-level and especially interesting for project managers, technical sales, architect and design folks but as both Ted and Patrick are gentle guys, they’ll allow everybody to jump in and join the discussion in a constructive mode.

 

Drop in I would say and let's have a heated discussion about all of this. I am pretty sure Ted will have some interesting opinions to share with you too.

Analysis Services Best Practise Checker V1.1 released

Today we release a new version of our best practise checker. Version 1.1 now checks for 28 best practises, nearly ten times more than the previous release. To give a bit of an impresion, we mention a few of the tests:

  • Are you using the most efficient SQL Server data provider?
  • Do your attributes have appropriate keys?
  • Are you using OrderBy and UnkownMember appropriately? The default settings are not always the best setting for these properties...
  • Are your hierarchies designed in a propper way?
  • Did you put distinct counts in separate measure groups?
  • Are your partitions reasonable in size?
  • Did you design reasonable aggregates?

We also improved the user interface.

You can export the detected violations into comma separated value (csv) or xml format, and import them later in the tool. Very handy to upload the information in Excel or a relational database. You can also generate reports on the detected violations. These reports can be viewed on-screen or exported to Excel or pdf.

A new option is to annotate a best practise violation. You can also mark a violation as 'Ignore': like most best practises, sometimes you might have good reasons to ignore a violation: the exceptions to the rules... It is also possible to include multiple databases and historical checks in a single analysis.

As you see, a lot of improvements. To download this tool, check our website.

Nico

MSPress Fast Track

This week I had a talk at the MSPress Fast Track in Frankfurt. It is a small annual seminar for the publishers and booksellers and although I was a bit afraid of the audience, it was a lot of fun. I finally got to meet the people who are responsible for delivering my book to the customers. The presentation was all about the world of SharePoint and the possible opportunities for booksellers. You can download it here. As said, it was a great experience and I also enjoyed the conversations with the MSPress guys and girls. In addition to the beers they were also pushing me to finish my writing (together with Lars) on the next MSPress book 'Inside the Index and Search Engines: Microsoft® Office SharePoint® Server 2007'. And of course, I'll be on time :). I am at my best under pressure!

Sharing a Microsoft Office Ribbon tab

At U2U we are currently very busy with creating 'Office Business Applications', an example of such an OBA application is the U2U Email Snippets, and I can already tell you that another great tool is coming up :-), so definitely stay tuned.

Sometimes when you create these office add-ins you meet some challenges or problems. In this article I want to give a brief explanation how you can share a Ribbon tab, so that you can create two buttons in the same ribbon and even in the same group on a tab.

This is also explained on the MS site but, they do it in three pages :-), I'm going to do it in a few lines :-) and some screens off course.

In this article I assume that you know how to create a Ribbon and with the Visual Studio Tools for Office 2007 it isn't that hard to do. So I've created 2 new projects and I've picked the 'Word Add-in' template.

image

When you create a project based on this template you got the files that you need to make an Outlook Add-in. I'm going to add a RibbonSupport Class to the project:

image

Go to the Codebehind of your ribbon, uncomment the partial class and run your program:

1

So the purpose of this article is to have multiple buttons in one tab. The key to success lies in namespaces: We are going to use the same or a shared namespace for the add-in. This is the Ribbon XML at this moment, not shared:

<customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui" onLoad="OnLoad">
  <ribbon>
    <tabs>
      <tab idMso="TabAddIns">
        <group id="MyGroup"
               label="My Group">
          <toggleButton id="toggleButton1"
                        size="large"
                        label="My Button"
                        screentip="My Button Screentip"
                        onAction="OnToggleButton1"
                        imageMso="HappyFace" />
        </group>
      </tab>
    </tabs>
  </ribbon>
</customUI>

This is with a shared namespace added in the customUI.:

<customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui"
         xmlns:shared="http://www.u2u.info/blogs/kevin"
          onLoad="OnLoad">

And then we are going to use this namespace in ribbon of the two add-ins:

First add-in:

<customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui"
          xmlns:shared="http://www.u2u.info/blogs/kevin"
          onLoad="OnLoad">
  <ribbon>
    <tabs>
        <tab idQ="shared:MyCustomTab" label="Kevin">
            <group id="MyGroup"
               label="My Group">
                <toggleButton id="toggleButton1"
                              size="large"
                              label="My Button"
                              screentip="My Button Screentip"
                              onAction="OnToggleButton1"
                              imageMso="HappyFace" />
            </group>
        </tab>
    </tabs>
  </ribbon>
</customUI>

Second add-in:

<customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui"
          xmlns:shared="http://www.u2u.info/blogs/kevin"
          onLoad="OnLoad">
  <ribbon>
    <tabs>
      <tab idQ="shared:MyCustomTab" label="Kevin">
        <group id="MyGroup"
               label="My Second Group">
          <toggleButton id="toggleButton1"
                        size="large"
                        label="My Second Button"
                        screentip="My Button Screentip"
                        onAction="OnToggleButton1"
                        imageMso="HappyFace" />
        </group>
      </tab>
    </tabs>
  </ribbon>
</customUI>

IdQ Stands for Qualified ID, and this is the id that we are sharing across the multiple ribbons.This will result in:

2

Off course you can go a step further and share the same group:

<group idQ="shared:MyGroup" label="My Group">

3 

So, I hope this one helps you as it helped me :-)

K.

Private fields Code

Because lots of people are interested in creating private fields I've decided to post the code that I've written for the private text field so you can apply it on all types of fields. You can download the zip file containing the project by clicking here.

You can buy me a beer to thank me, when you see me at a conference or at one of the U2U courses.

SPFarm, SPServer, SPServiceInstance and SPWebApplication and SPSite

This week I am visiting Denmark again. Lovely place, a bit cold but knowing that next week I'll be in Cyprus and then a week of Barcelona I can take it. I am delivering my favorite course (the advanced SharePoint dev course) One of the students at WM-Data asked me about the steps to start with the server farm, loop over all of the servers, get all of the IIS Web applications running on that server and from there looping over all of the site collections and possible the individual sites. Here is a small app I have created as a demonstration

farmservices

Here are the steps:

  1. Start by getting a reference to the SPFarm either the local or joined farm. You can even connect to a remote farm if you provide the connection string to the configuration database.

    SPFarm myFarm = SPFarm.Local;

  2. Connect to or loop over the servers part of the farm.

    SPServer myServer = myFarm.Servers["springfield"];

  3. Loop over all of the services running on that server represented in the object model as a SPServiceInstance type. The TypeName property is a good one to show since the DisplayName property is often an empty string.

     
  4. listBox1.DisplayMember = "TypeName";
    foreach (SPServiceInstance servinst in myServer.ServiceInstances)
    {
        listBox1.Items.Add(servinst);
    }
     

  5. One of these services is the Windows SharePoint Services Web Application. Grab it and cast the Service property to the SPWebService:

  6. SPServiceInstance servinst = (SPServiceInstance)listBox1.SelectedItem;

    if (servinst.Service is SPWebService)
    {
         SPWebService serv = (SPWebService)servinst.Service;

     

  7. Next retrieve the IIS Web Applications under the control of this service

  8.     listBox2.DisplayMember = "DisplayName";
        foreach (SPWebApplication webapp in serv.WebApplications)
        {
            listBox2.Items.Add(webapp);
        }
    }
       

  9. And then you can work with your site collections:

  10. SPWebApplication webapp = (SPWebApplication)listBox2.SelectedItem;

    listBox3.Items.Clear();
    listBox3.DisplayMember = "Url";
    foreach (SPSite sitecol in webapp.Sites)
    {
        listBox3.Items.Add(sitecol);
    }

Getting OBA Solutions Deployed by IT

The last two days I delivered the OBA TTT in Reading. It is always a nice experience to talk and demonstrate the power of the Office 2007 System platform (both client-side and server-side). We had a couple of good discussion points during the training regarding the adoption of Office Business Applications within organizations. In my experience, OBAs are seen by information workers as excellent ways to enhance their personal and team productivity. It is not hard to convince that group of people. Developers also start to realize that they can build these types of applications in a professional development environment (just look at the powerful support for building Office client solutions with VSTO Orcas). Developers understand that it is not anymore about VBA but it is about .NET, Web Services, SharePoint and connections to back-end data sources. My experience, and that was re-enforced by the feedback of the participants, is that it is now time to convince the IT people. Many IT departments don't like to push extensions to the client desktops anymore, and definitely not the Office environment since these products are critical to the users and if they screw up, they will be blamed. I don't think it is really a matter of Office 2007 not getting deployed on the clients. Many organizations are in the process of doing this. IT people however have bad experiences with VBA and COM add-ins that extended the Office clients in the past. They see the value but are sceptic about the deployment of these extensions. Personally, I feel that Microsoft should focus a bit more on the IT people the coming months regarding the OBA story. We should explain, document and demonstrate the various deployment options, how VSTO Orcas can help with that and also (very important) how to maintain and upgrade OBA solutions. I know there is some documentation available and I have contributed myself to some of it but I hope that the OBA team is doing an effort to push this even further. IT Forum in Barcelona is already a good opportunity. I haven't looked yet, but this seems to me an excellent opportunity to have a couple of sessions dedicated to deployment of OBA solutions. I know that they are still working on the content track so maybe I have some influence in here :).

To conclude, I'd like to thank Nick Swan and the UK SharePoint user group for the couple of beers Monday evening. It was fun to do the session and had a good time afterwards. If you are part of a user group and want to have me speaking one evening (you'll only have to buy me a couple of beers :)), have a look at my travelling agenda. I'll be more than happy to help you out.