Archive for the 'Programming' Category

Aug 26 2008

CRM4 Web Service Errors

Published by gringod 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:

<error>
  <code>0x8004111a</code>
  <description>An aggregate operation was initially specified, but no aggregate operator was encountered.</description>
  <type>Platform</type>
</error>

This error was being generated by the following FetchXML query:

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

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">
         <filter>
            <condition attribute="accountid" operator="eq" value="edd2b749-9f58-dd11-90aa-00155d0a0e03" />
         </filter>
      </link-entity>
   </entity>
</fetch>

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.

No responses yet

Aug 15 2008

When IIS Wont Start – Error 13

Published by gringod 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.

2 responses so far

Aug 14 2008

The Quick Way To Trash SharePoint

Published by gringod 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:

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

One response so far

Aug 11 2008

Try…Catch For No Reason

Published by gringod 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 »

No responses yet

Jul 14 2008

SharePoint Event Receiver Manager

Published by gringod under .NET, Programming, Software

One of the things I’m working on is Event Receivers in SharePoint but I’ve found registering the event receivers to be a bit on the annoying side.  Yes you can do it with the feature.xml Receivers section and there is the great El Blanco Event Receivers Manager.

EventReceiverManagerI personally prefer desktop GUI applications and so, based on code by Liron, I’ve created my own desktop Event Receiver Manager.  It allows you to select site & list, browse for an assembly so it can give you the full assembly name and a list of classes inside, and a list of receivers you can attach to.

The current version only allows adding new event receivers.  Before adding a new receiver it will check to make sure the same receiver doesn’t already exist.

Future plans for it include listing existing receivers to allow users to delete them but as I don’t need to do that myself yet I haven’t implemented it.

Download a copy of EventReceiverManager.

No responses yet

Jul 10 2008

SharePoint Link List – Part 3

Published by gringod under Programming, Technology

These are a selection of list of links that I acquired on a recent SharePoint developer course with Patrick Tisseghem of U2U.  This is part 3 of a 4 part series:

Workflow

Windows Workflow Foundation
http://netfx3.com/content/WFHome.aspx
An introduction and kick-off point for developers wanting to get started with Workflow Foundation.

Custom Workflow Activities
http://codeplex.com/SPDActivities
A set of handy SharePoint workflow activities for people that don’t want to get their hands dirty creating their own custom workflow activities.

Search

Microsoft search services
http://www.microsoft.com/enterprisesearch/products.aspx
Information on the Microsoft Search Server family of products.  Aimed more at decision makers than developers.

MOSS Faceted Search AddOn
http://www.codeplex.com/FacetedSearch
A most excellent add-on for the MOSS search system.  Allows for quick and easy refining of search criteria.

Silverlight

Silverlight for Sharepoint BluePrints
http://www.codeplex.com/sl4sp
Demonstrations of how Silverlight can be used with SharePoint.

Vertigo – FamilyShow
http://www.vertigo.com/familyshow.aspx
Example of using Silverlight in SharePoint

Deep Zoom Composer
http://blogs.msdn.com/expression/archive/tags/Deep+Zoom+Composer/default.aspx
Nothing to do with SharePoint but a very cool application.  Useful if you want to embed a Deep-Zoom show in SharePoint ;)

No responses yet

Jul 09 2008

SharePoint Link List – Part 2

Published by gringod under Programming, Technology

These are a selection of list of links that I acquired on a recent SharePoint developer course with Patrick Tisseghem of U2U.  This is part 2 of a 4 part series:

Utilities

STSAdm extensions
stsadm.blogspot.com
A set of extensions to STSAdm.exe that make just about any SharePoint administration task a piece of cake.  The extensions are packaged as a SharePoint solution package (.wsp) and are installed with the STSAdm.exe utility itself.

Sharepoint Project Utility
http://www.andrewconnell.com/blog/articles/ACs-VS-SharePoint-Project-Utility-Tool-Window-for-SharePoint-Developers.aspx
A utility for VS developers for creating the standard directory structures and default files for various SharePoint development scenarios.  Requires the installation of the DX Core VS addin.

VS2008 Sharepoint Extensions
http://blogs.msdn.com/sharepoint/archive/2008/06/04/announcing-the-vsewss-version-1-2.aspx
A set of projects and project items for VS2008 for SharePoint development.  My initial investigation suggests that these may be geared more towards MOSS2007 than WSSv3.

Event Receiver Management - El Blanco
http://chrissyblanco.blogspot.com/2007/08/event-receiver-management.html
Allows management of event handlers to specific lists, libraries, etc.

Application Pool Manager
http://www.harbar.net/articles/APM.aspx
System tray access to IIS Application Pool tasks.  Runs on the machine that SharePoint is installed on.

Fiddler - HTTP Debugging
http://www.fiddlertool.com/fiddler/
Useful tool for finding FrontPage rpc calls for uploading and downloading documents.

Expresso Regular Expressions
http://www.ultrapico.com/Expresso.htm
Wonderful utility for developing and debugging .Net regular expressions.  Once you’ve created and tested your regular expression, Expresso can generate stub .Net code to get the regular expression into your project.

Caml Query Builder
http://www.u2u.info/Blogs/karine/Lists/Posts/Post.aspx?ID=28
I’ve not had any experience with CAML yet but I’m sure I’ll be using this tool when the time arises.

Word Content Control Toolkit
http://www.codeplex.com/dbe
Assists with binding xml embedded in a Word 2007 docx file to controls in the Word document.  Useful for generating Word documents containing data from SharePoint.

SmartPart for SharePoint
http://www.codeplex.com/smartpart
The SharePoint web part which can host any ASP.NET web user control. Create your web parts without writing code!

One response so far

Jul 08 2008

SharePoint Link List – Part 1

Published by gringod under Programming, Technology

These are a selection of list of links that I acquired on a recent SharePoint developer course with Patrick Tisseghem of U2U.  This is part 1 of a 4 part series:

Articles & Blogs

SharePoint Developer Site
http://www.microsoft.com/click/SharePointDeveloper/

John Holiday
http://www.johnholliday.net/

Ted Pattison Group Downloads
http://www.tedpattison.net/downloads.aspx
A host of utilities, demos and articles.  Also, check out the rest of the site.

Ideas & Solutions, Etc.
http://blogs.msdn.com/johnlee/archive/2007/06/24/tips-tricks-from-moss-2007-development-training.aspx
A host of handy hints & tips.

Content Deployment
http://blogs.msdn.com/ecm/archive/2008/06/11/announcing-end-to-end-content-deployment-walkthrough.aspx
A guide to website content management and deployment using SharePoint.

OpenXML Developer
http://www.openxmldeveloper.org
Not really SharePoint specific but a developer site for working with the office documents OpenXML standard.  Useful for developers wanting to tie SharePoint data into Word documents (see Word Content Control Toolkit in Part 2 - Utilities).

3 responses so far

Jul 02 2008

Re-Installing Windows Sharepoint Services

Published by gringod under Programming, Software

Part of my job with Contract5 I have to do development on the Windows Sharepoint Services platform.  In order to facilitate this I setup a VMWare virtual machine with Windows 2008 Server, Sharepoint and Visual Studio 2008.

However, I made the bad error of deciding to change the computer name once all of the above was installed.  Unfortunately I didn’t realise that the computer name was so deeply rooted in the Sharepoint installation.  I also tried reverting the computer name back to it’s original value but this didn’t seem to make much difference, if anything it made the situation worse.

No amount of removing Sharepoint and re-installing it made any difference as the original settings still seemed to be there.  Eventually I gave in and completely rebuilt the VM.

I have since discovered that my problems were all due to the four Sharepoint databases that got installed the first time round which are not removed when Sharepoint is un-installed.  I have found a this knowledge base article on removing the Sharepoint databases: http://support.microsoft.com/kb/920277

No responses yet

Jun 05 2008

Levels of Enthusiasm Cycle

Published by gringod under Programming

Based on the Level of Enthusiasm blog post from Rick Strahl, I have come up with what I think is my enthusiasm cycle whilst developing software:development_cycle

Typically, for me, everything is based around a default state of “Rat race”. If nothing changes for a log period of time I’ll enter the “In a rut” state the only thing that really breaks that state for me is going on holiday for some “Down time”. This gets me back into the “Rat race” state.

If, whilst in the “Rat race” state I come up to a deadline, I move into the “Pressure cooker” state. I don’t know if this is peculiar to me but it is normally from this state that i enter the “Inspired & wired” state. When the rush is over it’s back to the “Rat race”.

This is a very generalised cycle and things may not always work like that. I may be in a rut and then come up against a deadline, or whilst having some down time I’ll have a flash of inspiration and come back to work raring to get coding.

No responses yet

Next »

Archives

RSS RideAround.net

RSS Twitter

What I'm Doing...

Nothing on the major news sites yet 2 weeks ago Apparently there is an air-traffic control failure in the UK 2 weeks ago the airport is surprisingly quiet this morning. Apparently it was manic earlier... I like quiet. 3 weeks ago More updates...

Posting tweet...

Powered by Twitter Tools.

RSS My Google Reader

Flickr Feed

www.flickr.com
This is a Flickr badge showing public photos from GrinGod. Make your own badge here.

Currently Reading

Digital Locals

Me Online

Meta

Google Ads

Spam Blocked

14,811 spam comments
blocked by
Akismet
114 feed subscribers


You are viewing a mobilized version of this site...
View original page here

Mobilized by Mowser Mowser