Wednesday, February 27, 2008

New free features by Scott

find new open source features for download on the feature codeplex project.

  1. Applying Unique Constraints to SharePoint List Columns
  2. Hiding Individual Menu Items on SharePoint Toolbars
  3. Reset Theme (sets the site theme and logo for every site in a site collection)
Way to go Scott!


Last Updated: 29/02/2008

here is something me and a couple of other MVPs have been toying with. The ten (or more) commandments for sharepointers:

  1. Thou shalt collaborate!
  2. Thou shalt develop on a server!
  3. Thou shalt not use smart part unless you understand what it does and it's ramifications.
  4. Thou shalt reverse-engineer undocumented API calls and internal classess of SharePoint OM
  5. Thou shalt not ask if CAML can make WHERE UNIQUE queries
  6. Thou shalt hold no other compression utilities before makecab
  7. Thou shalt add C:\program files\common files\microsoft shared\web server extensions\12\bin to your system PATH variable
  8. Tony Bierman says : Though shalt not deploy DLLs to the GAC unless absolutely necessary. Ishai Sagi says: Thou shalt deploy DLLs to the GAC unless absolutely necessary. (I forsee a bloody row about this)
  9. Thou shalt not covet thy neighbor’s MacBook Pro
  10. Thou shalt use CreateChildControls when you want asp controls in your web part.
  11. Thou shalt always create WSP solutions as part of your build. (Daniel Mcpherson)
  12. Thou shalt always test with accounts that DO NOT have administrator rights on the box.(Daniel Mcpherson)
  13. Thou shalt always test with accounts that DO NOT have administrator rights on the site.
So, do you have anything to add to the list? comment here, and I will add it if it is worthy of SharePointology!

And while I am at it, here is an original one: How do sharepoint MVPs communicate?
By MOSS Code!

Tuesday, February 26, 2008

My Sites are site collections

Most of you are probably turning away from the browser window in disgust, saying "I can't believe he didn't know that", but the truth is - I didn't. I just realized that each my site is actually a site collection on its own. That means it doesnt share the galleries with the my site host site collection (galleries such as master pages, web parts, site columns and content types) and makes management of my sites a bit more difficult.
However, this means that you can set quotas on my sites (which I guess is the reason that MS creates them as site collections).

Sunday, February 24, 2008

Windows 2008 Server - "The referenced component 'Microsoft.SharePoint' could not be found. "

Got this today on my windows 2008 VPC (which is also a domain controller) - "The referenced component 'Microsoft.SharePoint' could not be found." - basically I couldn't add a referance to sharepoint in visual studio (2008).
After I got over the heart attack, A friend (Mundeep!) suggested I start visual studio as administrator. I protested that I was logged in as administrator, but he reminded me that I am working on windows 2008 which, like vista, has user account control, and by default prevents me from doing many things on the client.
Running VS2008 as administrator solved the issue. And now I am going to remove the user access control and be happy ever after.
If you are also planning to work on win2008 as a development machine, I recommend the "Windows Server 2008 as Workstation" article, to which I linked in the past.

Tuesday, February 19, 2008

Installing a bluetooth stack in Windows 2008 Server, on a Dell XPS m1330

This has been a long, long day. Since installing windows 2008 I lost my bluetooth stack capabilities - meaning that while my bluetooth mouse worked, I couldnt add new devices, including my phone (which I sometimes use to connect to the internet through) and my stereo headset.
I downloaded everything there is (the entire internet) I finally managed to hack my way to getting it to work.

  1. Download the bluetooth drivers from Dell.
  2. Run the downloaded file. it will extract a lot of files, and start a setup application that will then get stuck on a window asking you to activate the bluetooth device by pressing fn-f2. Ignore that, and click "cancel installation"
  3. Open device manager. You should see an unknown device BCM2045. Click on that device, and tell it to reinstall driver
  4. When prompted, tell it to scan your computer, and point it at the folder where the extracted files are from the downloaded application in step one (default is C:\dell\drivers\R140135)
  5. When prompted tell windows to install the drivers inspite of them not being signed
  6. Ignore the errors about the other devices not finding drivers (I am still looking for a solution for that) if there are any
  7. When the drivers are installed, you should see the bluetooth icon in the taskbar. You can now run the setup from C:\dell\drivers\R140135 if you want (I am not sure if it makes a difference) and that is it - bluetooth away!

Do not do this. why? because while the stack is installed, it actually kills the internal bluetooth capabilities - the mouse stops working, and while the stack looks installed, actually anything you try to do with it fails - no audio, no mouse, no nothing.
Also, the graphic drivers didnt install, so when I came to the user group presentation, I couldnt connect to the projector.

However, as Fernando points out, the following article is a good place to start if you plan to use 2008 as a desktop.
I will wait for a bluetooth stack update. Until then, Vista SP1 away!

Monday, February 18, 2008

"you did not enter a shutdown reason"

This is amazing - I tried to log into a sharepoint 2003 (yes, yes - I am working on sharepoint 2003 now) VPC that I have copied from one machine to another, and had to delete the saved state. The VPC booted ok, but when I try to log in to the domain (domain controller is another VPC with sharepoint 2007 - what fun!) I get the following error:

"The system cannot log you on: you did not enter a shutdown reason"

The amazing part is - there is no mention of this error anywhere in google, Live or Yahoo (I thought I'd try them all just to be sure). Am I the first to generate this error?

Anyway - logging in to the local computer works, so I will try a restart and check it out. It may be because its expecting a loopback adapter that existed on the original machine, and in this machine I used NAT and now it cant see the domain controller.


Solution - remove machine from the domain, add it again to the domain. I suspect the machine was part of a domain with a different VPC, and even though the domain name was exactly the same (and probably the same VPC), it just plain refused to log in to the domain until I rejoined it.

Thursday, February 14, 2008

Accessing the resource file '*' has been dissalowed

On a new SharePoint dev server that I was given by a customer, I kept getting the following error in Visual Studio and in Reflector:

The problem turned out to be a registry key that no one knows why and how it got to be different than the default:


The value should be "0", but it was "1" - which means that internet explorer couldnt open files using the file:/// unc to access local files.

Thanks are to Michael Curran who found this solution.

Wednesday, February 06, 2008

Sample event handler to set a field as a pr imary key (enforce no duplicates)

Got this as a request from a reader- how to prevent users from adding items with same titles as ones that already exist in the list.
using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.SharePoint;

namespace SPSTIPS.SharePoint.EventHandlers
    public class TitlePrimaryEventHandler:SPItemEventReceiver
        const string TITLE_QUERY = @"<Query><Where><Eq><FieldRef Name=""Title"" /><Value Type=""Text"">{0}</Value></Eq></Where></Query>";
        public override void ItemAdding(SPItemEventProperties properties)
            if (properties.AfterProperties["Title"] != null)
                //get the title of the new item
                string currentTitle = properties.AfterProperties["Title"].ToString();
                //get the web site object
                using (SPWeb web = properties.OpenWeb())
                    //get the current list
                    SPList list = web.Lists[properties.ListId];
                    //query the list to check if there are items with the same title
                    SPQuery q = new SPQuery();
                    q.Query = string.Format(TITLE_QUERY, currentTitle);
                    SPListItemCollection itemsWithSameTitle = list.GetItems(q);
                    //if there are items, cancel the add, and show an error to the user.
                    if (itemsWithSameTitle.Count > 0)
                        properties.Cancel = true;
                        properties.ErrorMessage = "There is already an item with the title \"" + currentTitle + "\ in this list".";

Monday, February 04, 2008

Tzunami Deployer, Metalogix and an apology

My current customer is looking to upgrade to sharepoint 2007 from 2003, and that is a problem - we want to move to a totaly new information architecture, so just running "upgrade" will not do.
I have reviewed two products - >Metalogix Migration Manager for SharePoint and Tzunami Deployer that may help us, since their tools are built for that purpose. I am still resesarching on the differences between the two, and it seems that no matter what, we will need to write some code to apply our own rules on how content should be moved. As soon as I am sure I am well versed in the differences, I will post a review about the two.
One thing I can highlight now is that metalogix seems like a great solution not for an upgrade, but for deploying content between seperate farms by using a very simple interface.

Sorry - it has been a long time since I blogged about anything useful, and I refuse to blog about windows 2008 RTMing (oops!) and other such links. But I promise that as soon as I get a chance I will start again. The last few months were hectic with holidays and goodbyes (personal story), but now I should have more spare time, and since I am preparing for a lecture that I am giving in Tech Ed Israel - I would probably have some things to write about pretty soon!.