Archives

Archives / 2009 / May
  • New release for SPExLib with SharePoint Linq extensions

    Tags: SharePoint

    I'm really glad that we have managed to get a really nice release of the SharePoint Extensions Lib, SPExLib, out. This brand new release (12.0.0.0) has significantly been improved since the first release a couple of weeks ago.

    Keith Dahlby has made some really nice Linq extensions for SharePoint which is available in this release. These extensions are also IDisposable safe when using on SPWeb and SPSite collections.

    By referencing the SPExLib.dll and include the namespaces you can easily write code like this (taken directly from one of my current projects):

       1: SPList regions = web.Lists["Regions"];         
       2: regions.GetItems("<Where><Eq><FieldRef Name='Customer'/><Value Type='Lookup'>{0}</Value></Eq></Where>"
       3:                     .FormatWith(lookupValue)
       4:                 )
       5:            .ForEach<SPListItem>(
       6:                     item => ddlRegion.Items.Add(new ListItem(item["Title"].ToString(), item.ID.ToString()))
       7:             );

    As you can see the sample uses a number of extension methods; SPList.GetItems() can accept a CAML query directly, System.String has a FormatWith method, the SPListItemCollection has a ForEach method.

    Download it and try it out, you will find yourself more productive!

    Have a nice weekend.

  • SharePoint Online updated

    Tags: SharePoint

    Microsoft has updated SharePoint Online with a patch that resolves the bug that prohibited you from getting the service descriptions from the web services, that I previously described.

    This means that you now can use Visual Studio or SharePoint Designer (or any other tool that you like) to connect to the SharePoint Online web services and code away, instead of going to some local instance to get the descriptions.

    Does anybody know where the Microsoft Online team posts all updates/changes to the BPOS? I got this information from Troy (from the BPOS team) commenting on my post.

  • SharePoint Service Pack 2 known, found and experienced problems

    Tags: SharePoint

    Installing a new service pack onto a server product is not just firing up the installer and hit next->next->finish. You should carefully read through the documentation and test it thoroughly. Service Pack 2 for SharePoint has been long awaited and I’ve seen people the last 24 hours installing it like madness just wanting to get their hands on the new features/updates. I did also install it just minutes after it was released (on my dev machine that is being reinstalled any hour now, when Windows 7 RC is out). 

    Andrew Connell said it well in a tweet just recently: “I’s watching everyone else install #sharepoint SP2 to see if there are issues (ala IU's AAM fiasco)... thanks in advance guys :)”

    Twitter is one nice source of real-time update on what is happening right now on just about everything, especially when it comes to #SharePoint. I’ve collected some of the known, found and discovered problems with Service Pack 2 for Windows SharePoint Services 3.0 and Office SharePoint Server 2007.

    Have you experienced any other troubles, I’ll gladly update the list!

    If you’re anxious to install it, here is a great guide by Shane Young.

  • Introducing SharePoint Extensions Lib

    Tags: SharePoint

    I've had an idea for some time to gather all mine and others nifty extension, utility and helper methods into a shared library so that these can be reused in different projects and I finally got my act together and created a new project on Codeplex called SharePoint Extensions Lib, http://spexlib.codeplex.com/, SPExLib.

    SharePoint Extensions Lib

    This is a library filled with extension methods to the SharePoint object model and to the Microsoft.NET 3.5 SP1 classes as well as some helper classes. All you have to do is reference it in your solution and add the using SPExLib.Extensions statement to your code and you are ready to go.

    The goal with this project is to make SharePoint programming easier and to fill in the gaps left out in the standard SharePoint APIs.

    Version 1.0.0.0

    This first version contains extension methods such as:

    • SPWeb.ListExists() - checks if a list exists in a site
    • SPList.ViewExists() - checks if a list contains a specific view
    • SPListItem.Contains() - checks if a list item contains a specific field
    • SPListItemCollection.FindByField() - returns all items with a certain value to a specific field
    • Extensions to the XElement and XmlNode objects
    • A set of classes to make creation of WebParts with EditorParts easier to create
    • and more

    New versions will be released as soon as we have some new and cool extensions.

    Contributions - I want you

    I really would like to see contributions to this library, so feel free to contact me or write suggestions on the Codeplex discussions page. I know that you are sitting on really good stuff out there.

    If you have similar or better implementations that the ones already there, please feel free to show me a better implementation. Let's make this first class.

    You can also get the source and check it out and borrow some methods if you like. SPExLib is licensed under Ms-PL.

  • Virtualizing XP applications using Windows 7

    Tags: Visual Studio, Windows XP, Windows 7, Virtual PC

    Windows 7 has an upgrade to Virtual PC which allows you to run Windows XP applications virtualized on your Windows 7, without having to run the whole desktop running.

    I still have to use Visual Studio 2003 to support some old good applications including SharePoint 2003 apps. So I have used a Windows XP virtual machine to run it, but now I can fire up Visual Studio 2003 directly from my Start menu in Windows 7. As most of you know, you can't install VS2003 on a Vista or Windows 7 machine, and I don't even want it there either.

    It's also great for having Internet Explorer 6, 7 and 8 on the same machine!

    Here are some pictures of the Windows XP Mode features.

    Visual Studio 2003 running on Windows 7 using Windows XP mode

    Visual Studio 2003 running on Windows 7 using Windows XP mode

    Published XP Mode apps

    The published Windows XP applications in the Windows 7 start menu.

    image

    The Windows XP notification icons appear in the Windows 7 notification area. Note  the Windows Update and Windows Security Alert icons. I thought this was really cool.

  • Prohibit your users from selecting No Quota when creating Site Collections

    Tags: SharePoint

    I've been annoyed for some time at that you cannot prohibit your users from selecting "No Quota" when creating Site Collections. Yes, you can set a default to use but the "No Quota" option is still there. Most probably you have some governance plan or similar that says that you should set quotas when creating Site Collections, but you know that sometimes you forget or somebody doesn't even care or know what setting No Quota implies.

    No Quota when creating a Site Collection

    Create a feature that removes the No Quota option

    But, hey - I love to write code and I was sure that you could get around it in someway. First option I thought of was creating a custom Create Site Collection page (_admin/createsite.aspx), but that's not so beautiful right? But SharePoint has some nifty constructs that allow you to insert custom controls in most pages, called Delegate Controls. The create site collection page has one of those, so I wrote up a small control that uses the delegate control called CreateSiteCollectionPanel1 in the page I deployed to the farm.

    No Quota removed

    The code is pretty straight-forward; find the Drop-down list and then remove the "No Quota" option.

    Code for the Delegate control:

       1: protected override void OnPreRender(EventArgs e) {
       2:     Control c = this.Parent;
       3:     if (c != null) {
       4:         c = c.Parent;
       5:         if (c != null) {
       6:             c = c.Controls[23];
       7:             if (c != null) {
       8:                 c = c.Controls[4];
       9:                 if (c != null) {
      10:                     DropDownList ddl = c.Controls[1] as DropDownList;
      11:                     if (ddl != null) {
      12:                         if (ddl.Items[0].Text == "No Quota") {
      13:                             ddl.Items.RemoveAt(0);
      14:                         }
      15:                     }
      16:                 }
      17:             }
      18:         }
      19:     }
      20: }

    Code to add the Delegate control:

       1: <?xml version="1.0" encoding="utf-8" ?>
       2: <Elements xmlns="http://schemas.microsoft.com/sharepoint/">
       3:   <Control Id="CreateSiteCollectionPanel1"
       4:          Sequence="1"
       5:          ControlAssembly="NoQuotaLockDown, Version=1.0.0.0, Culture=neutral, PublicKeyToken=d4d7ec0041af2eda"
       6:          ControlClass="NoQuotaLockDown.NoQuotaLockDownDelCtrl"/>
       7:  
       8: </Elements>

    Download it!

    You can download the full solution package here NoQuotaLockDown.wsp or the source. NoQuotaLockDownSrc.zip.

    WSS vs MOSS

    This solution works perfect on a Windows SharePoint Services 3.0 farm, but should not be used as-is on a Microsoft Office SharePoint Server 2007 farm. MOSS already uses this delegate control in the SharePoint Portal Server Master Site Directory Capture Control feature. This feature uses sequence 100, so you can easily create a derivative of the MOSS feature and implement the No Quota removal. Another option is to change the delegate control behavior of the create site collection page and allow the delegate control to allow more than one delegate control.

  • Developers, prepare for the 64-bit revolution

    Tags: SharePoint, SQL Server, Virtual Server, Hardware, Windows 7, SharePoint 2010, Windows Server 2008, VMWare, Virtual PC

    The day has come when Microsoft officially started to talk about the next version of Office 2010 clients and SharePoint Server 2010 (no longer Office SharePoint Server). We have since some time known that SharePoint 2010 will be supported only on a 64-bit platform, just as Exchange 2007.

    The new stuff revealed yesterday (as preliminary) are that not only is 64-bit required, it will only be supported on the Windows Server 2008 64-bit platform (including R2) and it will require that you have SQL Server 2008 on a 64-bit platform. There are some other interesting facts that you should check out also in the post (and on about 1.000 other blog posts), but this post is not just about these news.

    The interesting parts of this announcement is that now is the time to learn the 64-bit platform for real and especially Windows Server 2008 R2 and SQL Server 2008, not everything is the same; registry hives, file system, settings, know when to use int (Int32) or Int64 etc etc. You can start now, it's no time to wait! Make a decision to only install your new SharePoint installations on the required SharePoint 2010 hardware, make sure that you have that in your development environments and on your virtual machines. Yes, it will in many cases cost you a bit in new hardware.

    I think that this is the time when 64-bit really will kill the 32-bit era.

    As a bonus I can tell you one thing that I didn't know was achievable. My main laptop runs 32-bit Windows 7 and not 64-bit due to that it does not have the 64-bit driver support for the peripherals and I usually use(d) Virtual PC to virtualize my development servers. Downside with Virtual PC is that you guest machines can only be 32-bit and I don't want to have a Hyper-V laptop in 64-bit mode so I thought that I had to get me a new laptop (which is due for later). I was preparing for the worst of having a dual boot. Fortunately I did a test using VMWare Workstation today and found out that as long as you have a 64-bit capable hardware (which I have) you can host 64-bit guests on a 32-bit host OS. Did you know that, I did not! So I will spend this evening preparing my new development VM's. If you are in the same situation as me, stuck with a 32-bit OS for some time, head on over to VMWare and run the 64-bit compatibility checker and then dump Virtual PC and get VMWare Workstation.

    Welcome to the 64-bit world!

  • ChartPart 2.0 for SharePoint video demonstration

    Tags: SharePoint, CodePlex

    I just had to try out Community Clips from Microsoft Office Labs and made a short video demonstrating the new version of ChartPart 2.0 for SharePoint . The video shows rendering and customization of the graph, how you connect the graph to a list and some of the 3D features.

    Community Clips is an awesome and simple video capture utility that from now on definitely will be a preferred tool in my toolbox.

    Enjoy...and if you like go ahead and download ChartPart 2.0 at http://chartpart.codeplex.com (currently in beta).

    Updated 2009-05-11: clarified that this is ChartPart 2.0 for SharePoint (Services) 3.0

  • Reinstalling SharePoint after a failed Language Pack install

    Tags: SharePoint

    After doing some experimental stuff (don't ask me what!) with my local (Windows 7) SharePoint installation I uninstalled it completely and was going to install it from scratch once again I encountered a strange error. A dialog as below popped up:

    The product ID specified was not found on the machine.

    First I thought that SharePoint did not uninstall correctly and searched the registry as a maniac and found nothing. Then I checked the installation log files, which did not make things much clearer:

       1: Error: Server products do not support select UI Type: InvalidProductFromARP. 
       2: Showing parent-less message Title: 'Setup Error', Message: 'The product ID specified was not found on the machine.' 
       3: Message returned: 1 
       4: Error: Server products do not support select UI Type: InvalidProductFromARP. 
       5: Catalyst execution finished: 05/08/2009 14:52:39.  Return code: 30040.  Exception caught: InvalidProductFromARP. 
       6: PERF: TickCount=11319697 Name=RunSetup Description=End function

    After some investigation I checked the folder that the setup program extracts the files to, which always have the same name and is not removed after the installation is done (*see more information below). It's located in c:\Users\Profile\AppData\Local\xtracted\. There I found some "leftovers" from the failed language pack, see image below. Folders such as WSS.sv-se and WSSLPK.sv-se is used during the installation and therefore checked when installing WSS. And since I have removed everything and have no WSS on the machine it fails when installing the language packs.

    xtracted

    After removing the xtracted folder everything went smooth.

    This little adventure gave a good insight on how the SharePoint installer works and it's a smart one.

    * Worth to notice that all of this is experienced on Windows 7 RC using WSSOnVista. So it might not be the same on a server installation, but I will for sure make sure that the extracted folder are removed before I reinstall SharePoint on any machines in the future. On Windows Server 2003 and Windows Server 2008 I have not seen any leftovers from the xtracted folder, but I have not verified it.

  • Tip: Store your Codeplex passwords

    Tags: Visual Studio, Windows Vista, Windows 7, CodePlex

    Here is a tip for you Codeplex users out there.

    TFS Connect dialog If you are using the Visual Studio and the Team Foundation source control then you are prompted for username and password every time you open up a project. This dialog does not contain any functionality to store the username and password. If you are often opening projects and/or switching projects entering usernames and passwords can get annoying.

    If you are using Windows Vista or Windows 7 you can store the usernames and passwords in a pretty secured way using the Credentials Manager.

    The Credentials Manager is found in the Control Panel, just search for it. To add a username and password all you have to do is click on Add a Windows credential and then enter the name of the Codeplex TFS server (tfsXX.codeplex.com) and then you username and password. Click Ok and then fire up your Codeplex solution in Visual Studio and you are ready to get back to coding!

    Credentials Manager

    Until next time...

AWS Tracker

About Wictor...

Wictor Wilén is a Director and SharePoint Architect working at Connecta AB. Wictor has achieved the Microsoft Certified Architect (MCA) - SharePoint 2010, Microsoft Certified Solutions Master (MCSM) - SharePoint  and Microsoft Certified Master (MCM) - SharePoint 2010 certifications. He has also been awarded Microsoft Most Valuable Professional (MVP) for four consecutive years.

And a word from our sponsors...

SharePoint 2010 Web Parts in Action