U2U Blog

for developers and other creative minds

Roadmap for Commerce Server

I know a couple of people who will be interested in reading about the coming future for Microsoft Commerce Server. I had hoped there would be more SharePoint integration, possibly having a whole bunch of Commerce Server Features on top of WSS 3.0 just like you have for example the Business Intelligence Features. This is not the case. Microsoft Commerce Server "7" will be separate from WSS 3.0 but for as far as I can read, there will be integration via Commerce Server Accelerators. In my opinion not the best approach but hey… not everything has to run on top of the WSS 3.0 platform, is it (or not?).

Analysis Services Best Practises Analyser

Analysis Services, Microsofts OLAP and Data Mining engine, is a very powerful tool. But like many powerfull tools, if you don't configure it in the right way, it impacts the performance. There are a bunch of 'best practises', but now there is also a tool which automatically checks these.
 
Analysis Services Best Practise Analyser checks your live OLAP databases against some key Best practises. Currently, it checks for aggregations, attribute relationships and non-empty behavior on calculations, but we plan to add more in the future. Try it out for free!
 
Nico

SharePoint PowerShell for Beginners

This is a first post of a series on how you can use PowerShell on the SharePoint object model and its web services. This post will give you an introduction on how to work with the SPSite and SPWeb objects.

Open a PowerShell command prompt. As we are going to explore the SharePoint object model, you need to have PowerShell installed on a machine where you installed SharePoint.

The first step is to load the SharePoint assembly:

[System.Reflection.Assembly]::LoadWithPartialName(”Microsoft.SharePoint”)

Instantiate an SPSite object:

$siteurl = "http://boske.litwareinc.com"

$mysite=new-object Microsoft.SharePoint.SPSite($siteurl)

Now you have a variable mysite, which contains an instance of type SPSite:

You can explore the content of the mysite variable by executing following command:

$mysite

Or to have the information listed per page:

$mysite | more 

To list all the members of the site object:

$mysite | get-member | more 

or the shorter notation:

$mysite | gm | more 

You can also list only the properties of the site object:

$mysite | gm -membertype property | more 

To view the content of a property of the site object:

$mysite.AllWebs

But this shows the whole content of all webs in the site collection. If you want to see only a few properties of each web, you could execute the following:

$mysite.AllWebs | format-table Url, ID, Name, AllUsers

or the shorter version

$mysite.AllWebs | ft Url, ID, Name, AllUsers

To get the webs ordered by the last time that the contents have been changed:

$mysite.AllWebs | sort LastItemModifiedDate | ft Url, ID, Name, LastItemModifiedDate  

To loop through all webs of the site object and show the web Url and the Title of each list:

$mysite.AllWebs | foreach { $_.Lists | ft $_.Url, Title}

You should see something similar like this:

You can also execute a methods of objects. Just for fun, I will show you how to execute a CAML query:

$mytestweb = $mysite.OpenWeb("testsite")

$listguid = new-object System.Guid("f0715075-5159-43d7-99b7-3897824fbbff")

$productlist = $mytestweb.Lists[$listguid]

$query = new-object Microsoft.SharePoint.SPQuery();

$query.Query = "<Where><BeginsWith><FieldRef Name='ProductModel' /><Value Type='Text'>Mountain</Value></BeginsWith></Where><OrderBy><FieldRef Name='ProductModel' /></OrderBy>"

$productlist.GetItems($query) | ft Name

You can also view all static members of the SPSite class:

[Microsoft.SharePoint.SPSite] | get-member -static 

If you want to execute a static member:

[Microsoft.SharePoint.SPSite]::MaxWebNameLength 

I hope you liked the introduction on how to use PowerShell in combination with the SharePoint object model.

GroupIds and Locations in CustomAction Elements within a Feature Element Manifest

There are a couple of nice postings on the topic of the possible values for the attributes GroupId and Location in the Feature element manifest file. Chris O'Brien has a good listing of possible values and Robin Meuré recently extended on it by pointing to a specific SharePoint control (the FeatureMenuTemplate control) responsible for the inclusion of the dynamic hyperlinks or other custom actions made available through Features. Actually, this is not the only control that is capable of doing this. You can find similar controls in many places. For example, when you want to add a hyperlink to the Site Settings page, you can navigate to the C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\LAYOUTS\settings.aspx. Open it in Visual Studio and you'll find at the bottom of the ASPX the following definition:

<SharePoint:FeatureLinkSections runat="server" 

        ID="SettingLinks" 

        CellPadding="1" CellSpacing="2" Width="100%" 

        Columns="<%$Resources:wss,settings_numcolumns%>" 

        Location="Microsoft.SharePoint.SiteSettings" 

        VerticallyAlignSections="true" 

        OnAddGroup="OnAddGroup" 

        OnAddLink="OnAddLink"/> 

 

Isn't SharePoint fun J...

Include Items from Folders within your CAML Query Results

This week I am teaching an advanced SharePoint 2007 development course here in Brussels (next one is end of September). It's a lot of fun to go through all the material and I have invested a lot of energy in updating the lab material to provide an end-to-end scenario for the students to work out. All Feature-based of course; avoiding as much as possible to create stuff using the browser. Next week I'll teach the same course in Norway. It will be a busy week since I have more than 30 participants. And we already have a beer-drinking evening planned (of course J).

A student came with an interesting question regarding CAML queries: "If we execute a CAML query using SPQuery, can I have the items from subfolders included in the results returned?".

By default, only items out of the root folder are returned but there is a property you can set to get the results out of a folder (or all of them if you write a small loop).

SPSite site = new SPSite("http://moss.litwareinc.com/testsite");
if (site != null)
{
   SPWeb web = site.OpenWeb();
   foreach (SPList docLib in web.Lists)
   {
     if (docLib.Title == "Shared Documents")
     {
     foreach (SPFolder subFolder in  docLib.RootFolder.SubFolders)
     {
        SPQuery query = new SPQuery();
        query.Query = "<OrderBy><FieldRef Name='Title'/></OrderBy>";
       query.Folder = subFolder;
        System.Data.DataTable table = docLib.GetItems(query).GetDataTable();
     }
   }
 }
}

Thanks CAML girl for the suggestion J

Update: Michael Hofer has a good posting showing how to recursively get the items out of the folders using a CAML query.

New version of the Package Explorer

Wouter van Vugt created a new version of the Package Explorer, an excellent tool to explorer documents stored using the Office Open XML File Format. As a trainer, it is a great tool to demonstrate and discuss the internals of documents created in for example Word 2007.

Read more over here.

Farewell to a good friend

Today, I say farewell to a person I will miss a lot. David, a charming man as Morrissey would say, was a good friend. Actually, I don't remember when we became buddies. It seems he has been part of my life all the time sharing the same passion for alternative music, sports, cars and Microsoft technology. We could talk for hours about all of this, even while jogging on Sunday mornings (I cursed him for forcing me to do this btw). David was responsible for a couple of very important decisions in my life. Without him, I would not be the same person today.

But all of that is gone now - nature can be very hard. The only things I have are the good memories, and I'll cherish those. Rest in peace my friend… Thanks for everything you've done for me and my family. We'll never forget you.

Holidays in Cyprus

For the first time, we've spent our summer holidays in the new house (see red square beneath) in Moutagiaka, a small suburb of Limassol (Cyprus).

The house is in a complex with about 15 houses around a central swimming pool. Most of the residents use it as a holiday house (as we do) but there are one or two local people who bought one of the houses.

The girls of course love the swimming pool, the many beautiful beaches and the shopping in Limassol. This year however was a bit too hot for most of us (every day > 40°). Even the local people were complaining about the heat and humidity.

But in the evening things got better and we had a lot of fun.

Take for example my youngest Laura who is a big fan of Verka Serduchka and demonstrated this at a wedding we attended.

And I had a good time with my friend Lycourgos.

Hope to return very soon J