Archive for August, 2008

Aug 26 2008

CRM4 Web Service Errors

Published by under Programming

As well as starting to work with SharePoint in the last two months, I’ve also been doing some development in Dynamics CRM4.  In the past week I’ve been porting an ISV add-on that was written for CRM3.  Whilst most of the code is pretty much the same, there are a few gotcha to watch out for.

The first problem I came across was the web-service authentication.  I’m not a CRM expert but I believe this has something to do with the new multi-tenancy installation option.  Now when you connect to a web service you need to create a CrmAuthenticationToken and pass it to the web service.  This allows you to specify which organisation you are connecting to.

Once connected to I started getting the following error when running a FetchXML query:

  <description>An aggregate operation was initially specified, but no aggregate operator was encountered.</description>

This error was being generated by the following FetchXML query:

<fetch mapping="logical" aggregate="true">
   <entity name="account">
         <condition attribute="accountid" operator="eq" value="edd2b749-9f58-dd11-90aa-00155d0a0e03" />
      <link-entity name="contact" from="accountid" to="accountid">
         <attribute name="contactid" aggregate="count" alias="myCount" />

The purpose of this query is to count all the contacts that are linked with a specific account.  It does this selecting an account entity with a specific id and then counting all the contact id’s for the contacts that are linked to the account.

For some reason the xml parser finds the aggregate=”true” flag but doesn’t find the count aggregate on the linked entity.  Quite why this works in CRM3 but not in CRM4 is beyond me but what I do know is that turning this query around works:

<fetch mapping="logical" aggregate="true">
   <entity name="contact">
      <attribute name="contactid" aggregate="count" alias="count" />
      <link-entity name="account" from="accountid" to="accountid">
            <condition attribute="accountid" operator="eq" value="edd2b749-9f58-dd11-90aa-00155d0a0e03" />

In this case the query is run against contract and the id’s are counted where they are linked to a specific account.  I assume this works because the aggregate attribute is on the root entity.  I haven’t tested if it is possible to add more aggregates to the link entities or not.

One response so far

Aug 16 2008

Guernsey Roads In Google Earth

Published by under General

GuernseyRoadsGoogleEarth I just opened up Google Earth to take a look at Georgia and the surrounding area.  As always I looked at Guernsey first and I was pleasantly surprised to see that Google has finally added road for the island.  They still haven’t updated the aerial images to a higher resolution.

On a side note, Jersey roads have also been updated… but no one really cares about that do they ;-p

No responses yet

Aug 15 2008

When IIS Wont Start – Error 13

Published by under Programming

This morning I ran into a problem when running a repair on my broken SharePoint installation.  Everything seemed to be going well until the setup needed to restart the World Wide Web Publishing service (IIS).  The error message was rather cryptic, say that it might be due to my login account not having service start permissions – but I know I have.

Debugging step 1:  Look in the windows services list and see if I can manually start the service. This was a little more helpful as it told me it couldn’t start due to a dependency not starting.

Debugging step 2: Check the service dependencies.  It appears that the Windows Process Activation service (WAS) wouldn’t start, although it only returned the message “Error 13: The data is invalid?.

Debugging Step 3: Check the system event log.  Here I found the most helpful message so far:

The Windows Process Activation Service encountered an error trying to read configuration data from file ‘\\?\C:\Windows\system32\inetsrv\config\applicationHost.config’, line number ’0′.  The error message is: ‘Configuration file is not well-formed XML’.  The data field contains the error number.

It seems that at some point the applicationHost.config got trashed.  Luckily, when you make changes to web applications in IIS it creates a backup of the applicationHost.config file in c:\inetpub\history.  All you need to do is copy a good copy from the history and put it into c:\windows\system32\inetsrv\config.

And Roberts your mothers brother, WAS starts, IIS starts and the repair of SharePoint can continue!

ps. I’m running IIS7 on Windows 2008 Server.

39 responses so far

Aug 14 2008

The Quick Way To Trash SharePoint

Published by under Programming

I have just leant the hard way that you should always check the name you have given your feature before deploying it to a server.

Quite stupidly I created several features, at least two of which I now know conflicted with existing SharePoint features.  I used the xcopy method of deploying the feature on my local dev machine with the “/Y? switch to suppress prompts when over-writing existing files, so at the time I didn’t realise what I had done.

It was only when I can to create a new site collection that everything call falling down.  I’m currently downloading the SharePoint installation DVD from Microsoft in the hopes that a re-install will fix the problems.

From now on I’m going to be prefixing all features I create with the clients name.  This will provide two benefits:

  1. It will greatly reduce the risk of a feature name conflict.
  2. It will group all the directories together in explorer for easier deletion.

One response so far

Aug 11 2008

Online Reservations

Published by under General

With my new job I have been traveling to Jersey for several days every week.  This inevitably involves booking a hotel room to stay in.  Initially I started looking online for booking rooms but it soon became apparent that there are quite a few hotels that don’t have online booking.  So I started phoning hotels.

For the past two weeks now I have found rooms in hotels which have had online booking but which said that the hotel was full on the night that I wanted to stay.  Also, the hotel I stayed in last week was £30 cheaper when I made the reservation than the price that is listed on the website.

Quite how they get the discrepancy between the systems is any ones guess.  I just don’t want to be there when it goes the other way and the online booking system thinks there is a free room when in reality there isn’t.

No responses yet

Aug 11 2008

Try…Catch For No Reason

Published by under .NET,Programming

I’ve seen this time and time again and I’m sure just about every developer out there has seem the same sort of thing:

try {
    //many lines of code
catch (Exception ex) {
    throw new Exception("Something went wrong dude!");

This is probably the single most un-helpful piece of code a developer can write.  All you are doing is making you life and future developers lives harder when it comes to debugging.  The whole point of the try…catch block is for times when you know an exception may happen and it allows you to gracefully handle it without the whole system crashing to the ground.

So lets have a closer look at what’s wrong with this code:

Continue Reading »

One response so far

Aug 09 2008

How did I get started in software development?

Published by under General

I’ve had this in my drafts for a couple of days.  So here goes with a meme forwarded to me by DamienG:

How old were you when you first started in programming?

I was a bit of a late starter when it comes to computers.  I didn’t get my first computer until I was (IIRC) 16.  I dabbled a bit with QBASIC with a friend of mine.  I didn’t start proper programming until I did a summer at Milvus (previously Datalink, now it’s Microgen) when I was 17.

What was your first programming language?

Technically it was QBASIC but I didn’t really know what programming was about when I was playing with that.  The first language I used and really recognised as programming was Visual Basic 6.

What was the first real program you wrote?

Looking back my programming history looks like a mine field of little utilities and big projects that I worked with other programmers on.

I guess the first program that I wrote that I know that people out there in the real world used is a tool called MojaviBuilder (still on this blog somewhere) that generated the files required for a PHP MVC framework called Mojavi.

What languages have you used since you started programming?

That all depends on how you define “used?.  If you take it in it’s loosest form I’ve used the following:

Perl, Python, PHP, Ruby
C, C#, Java, JavaScript

If you want to stretch the term programming language, I can also include:

Bisson, Flex, XSLT, RegEx, Brainf*ck

What was your first professional programming gig?

The first time I got paid for programming was when I was 17 and work a summer at Milvus although I’m not sure that would come under the heading of professional, as it was mostly doing little in-house stuff that no-one else had time for.

My first proper programming job was during my second and third year of university when I was DBA and web portal developer on an international head injury drugs trial being run out of London.

If you knew then what you know now, would you have started programming?

Hell yeah! Although I would have started earlier.

If there is one thing you learned along the way that you would tell new developers, what would it be?

Care about what you are doing and think about the users that will end up using it.  The moment you loose sight of those to things it’s time to move on.

What’s the most fun you’ve ever had programming?

I always have the most fun when I’m learning something new.  I love that wow-feeling of everything  clicking into place.

The best moment was probably when I put my first utility online, saw people starting to download it and got my first email of thanks.  That’s a pretty awesome feeling.

No responses yet

Aug 09 2008

SharePoint Feature Scope Level

Published by under General

Do you find it hard trying to remember what level to scope your SharePoint features at?  Well worry no more, Serge van den Oever has put together a handy list or feature types and at what level they can be scoped at.  It also includes some other comments and hints for the various feature types/

No responses yet