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.
huh!
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!

Update:
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.


Update

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:


HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\policies\Explorer\NoFileUrl




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.

Apology
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!.

Thursday, January 10, 2008

Getting user profile values that support multiple value

I noticed today that the MSDN article "User Profiles Object Model Overview" has a wrong code sample for the "correct way of retrieving a user profile property value". The code sample there will not work, because the object model in sharepoind doesnt have the methods and objects the sample code is using.
Therefore - here is my correct way:

if (Profile[this.UserProfilePropertyName].Count == 1)
    return Profile[this.UserProfilePropertyName].Value.ToString();
else
{
    StringBuilder ret = new StringBuilder("");
    UserProfileValueCollection values = Profile[this.UserProfilePropertyName];
    System.Collections.IEnumerator allValues = values.GetEnumerator();
    while(allValues.MoveNext())
    {
        ret.Append(allValues.Current.ToString());
        ret.Append(";");
    }
    return ret.ToString();
}

Tuesday, December 18, 2007

This is customer support!

Sorry - another non-sharepoint post. I promise to post something good later today.

I just got a response from the GPS company TomTom about a question I sent them. You see, my TomTom GPS is also a bluetooth hands free in my car, and has a microphone that you attach to the sun screen which allows you to talk with great sound quality. The problem is that tomtom never expected someone like me to use that - I broke the microphone clip after about 8 months use.
The annoying thing - they dont sell spare parts. In the UK you can buy another set of microphone+clip, but here in Australia it is not available for some reason. So I got to tomtom web site, and in the support section asked for help. within a day (!) I got a response that they are sending me a replacement!

This is the kind of customer service I like to see. I know that the next GPS I get will be a tomtom.

Side note - if anyone from tomtom is reading this - can you add an Israel map to your collections of maps? I really want to travel with my tomtom...

Sunday, December 16, 2007

DELL XPS and 64bit operating systems

This has me angry enough to blog about. I have a Dell XPS m1330 laptop. Its a great laptop - fast, small, efficient and best of all - it is configured with all the best options available from dell (except for a solid state hard drive), including 4GB RAM - which dictates a 64bit operating system to take advantage of the juice.
The only problem is that you cannot install a 64bit operating system on it without turning off AHCI - which sucks. I called Dell, and a supporter named "Michael MG" confirmed that they (dell) do not know what drivers are needed to download to make this work (he advised me to "google it") and when I asked, if my laptop doesnt have a "A:" drive how do I install drivers during windows installation. Michael told me that I can't and therefore should only install windows 32bit or turn off AHCI support.
WTF?!
Does anyone know if the Apple machines support AHCI on vista 64bit?

Tuesday, December 11, 2007

Service pack is released

Ok, so all other bloggers are talking about it, you probably dont need me to tell you - but just in case I have a reader who only reads my blog - here are the links to the service packs:
  1. Windows SharePoint Services v3 SP1
  2. Microsoft Office SharePoint Server 2007 SP1
  3. Office SharePoint Designer 2007 SP1
I didn't install those myself yet - if I run into trouble I will post.