Tag Archive 'web service'

May 15 2009

VisendoSMTPExtender Management Web Service

Published by under .NET,Programming,Software

Background:

For work, I’m using a Windows 2008 Server virtual machine for doing all my SharePoint and .Net development on.  As it has got all of the cool stuff I’m working on, it is also the machine that I use to demo what I can do to clients.  Recently I’ve had a bit of a serge in the number of clients wanting to see Nintex Workflow 2007 (NFW2007) for SharePoint.

One of the cool features of NWF2007 is the whole Lazy Approval system, whereby users don’t have to go into SharePoint to approve to decline requests, they can just reply to the notification email with “approved”, “declined”, “ok”, “yes”, “no” or any other recognised word as the first line of the email.  In or to demonstrate this I need to setup and email system on my local machine.  The SMTP (sending) side of things is easy as it is built in to Windows 2008.  However, POP3 is a bit of a problem.  Previous version of IIS had a simple POP3 service but that has been dropped in IIS7.  The Microsoft way would be to install Exchange Server but that is a little too heavyweight for what I am trying to acheive.  Luckily a company called Visendo provides a free solution to plug the gap.  So now I can demo Nintex notification features.

Another feature I also wanted to demonstrate was setting up Active Directory accounts and then using those new accounts.  Nintex has got actions that allow you to interact with Active Directory but to then do anything usefull with the account required modifying xml config files and restarting the Visendo service.  But Nintex can call web services, so I’ve created a web service that has an AddAccount and DeleteAccount methods to update the Visendo configuration and restart the service.

Download:

I’ve made the source code for this web service freely available should anyone else want to have this sort of functionality: VisendoSMTPService.  The code is written against .Net 3.5 and is provided “as is” with no sort of warranty and is most definitely NOT recommended for live systems.  The code is released under a BSD License.

3 responses so far

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:

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

One response so far