Net stop / Net start

Developing lots of workflow dll:s? Add the following text to the prebuild events (if you are developing on the server):
net stop “Microsoft CRM Workflow Service”

and then
net start “Microsoft CRM Workflow Service”

which will save you the time of turning the Workflow-service off and on manually with each compilation.

If it is a live server, make sure you understand the complications!

Gustaf Westerlund
CRM and SharePoint Consultant

Humandata AB

Creating CRM-emails in C# code

I have in a previuos post described how to programmatically download a SQL RS report, create a CRM email and attach the report as a pdf to it and send it. This is quite many steps and sometimes it will just be good enough to send mails, for instance when developing addons for workflows.

email em = new email();

activityparty fromparty = new activityparty();
fromparty.partyid = new Lookup();
fromparty.partyid.type = EntityName.systemuser.ToString(); //Change to some other entity if needed.
fromparty.partyid.Value = FROM-SYSTEMUSER-GUID;
em.from = new activityparty[] { fromparty };

activityparty toparty = new activityparty();
toparty.partyid = new Lookup();
toparty.partyid.type =; //Change to some other entity if needed

toparty.partyid.Value = TO-CONTACT-GUID; = new activityparty[] { toparty };

em.subject = SUBJECT-STRING;
em.sender = ““;

em.regardingobjectid = new Lookup();
em.regardingobjectid.type = EntityName.REGARDING ENTITY TYPE.ToString();
em.regardingobjectid.Value = REGARDING OBJECT GUID;
em.description = BODY-STRING;

em.ownerid = new Owner();
em.ownerid.type = EntityName.systemuser.ToString();
em.ownerid.Value = OWNER-SYSTEMUSER-GUID;
Guid createdEmailGuid = service.Create(em);

SendEmailRequest req = new SendEmailRequest();
req.EmailId = createdEmailGuid;
req.TrackingToken = “”;
req.IssueSend = true;

// Send the email message.
SendEmailResponse res = (SendEmailResponse)service.Execute(req);

I find this code very helpfull. It can probably be generalized by using BusinessEntity object and so forth but I am usually quite satisfied with this.

Gustaf Westerlund
CRM and SharePoint Consultant

Humandata AB

Getting lots of copies of your mails

The new feature of email enabled document libraries in SharePoint 3 is great, but I recently experienced problems with getting a new copy of the mail every five/ten minutes. After a bit of error searching, I found that it was due to the fact that SharePoint didn’t have delete access rights to the “drop” folder in the c:inetpubmailroot directory, hence after sharepoint has read the mail, it can’t delete it. The next time sharepoint polls the directory, it will find the same mail and add it again, and again, and again… so just make sure the access rights are right.

Gustaf Westerlund
CRM and SharePoint Consultant

Humandata AB

Blogging and being a consultant

Some of you who read this blog are probably consultants and find it strange (or stupid) that I should share my knowledge with you and others on this blog and in the forums that I attend (mostly the swedish forum Some other find it strange that I wont give answers to certain questions, so I thought I might clear things up a bit by describing my thoughts on what to blog on and what not.

In general, I will blog on topics that are non-customer specific, meaning that I will discuss common problems, design patterns, installation issues, tips and tricks. I might also discuss a specific solution in the aspect that it might be of interest for other implementors as inspiration. However, specific customer problems that are very unlikely to happen in other environments, customer specific analysis and designs are what I do for a living. I will not blog on these topics, in more than a general sense.

So, I will be more than happy to share my thoughts on common issues and if you want my opinion on any of those, please comment my blog or send me an email at gustaf (a)

I apply the same rules for postings in forums meaning that I will not answer questions like:
“We are a company that has 50 emplyees with 10 inside sales and 4 outside sales. How should we configure CRM?”. This question can only be answered by doing a deeper analysis of how the companys sales processes (and other processes) work, and the answer is a CRM design. The same question but focused on which license or what hardware would be needed, is more of a general question and this I could discuss.

Of course there will always be gray areas and I will leave this to my judgement and I hope you will respect this.

As for commenting, your chances are a lot greater if your comments are not anonymous. I also like to quote my grandfather who used to say: “It is better to drive a strong point than strong language (freely translated from Swedish)” meaning that harsh language will get you nowhere.

Gustaf Westerlund
CRM and SharePoint Consultant

Humandata AB

Where to place your custom aspx files

Today I held another crash-course in Extending MS CRM 3 with .NET. It is a very comressed version of the MOC (Microsoft Official Curriculum) course with the same name. The attendées were 4 very sharp CRM professionals from Cybernetics and Releye. If you are interested in attending this course please contact Informator at

We were discussing the problems with kerberos double-hopp trust delegation when using a SQL RS on a different server than the CRM server. It dawned on my however that a similar problem might acctually arise if you choose to host your custom aspx-files on a separate server from the CRM-server. I am no expert at this kerberos stuff but would find it quite possible that you might get this problem. I havn’t tested this, so treat it as a hunch. If anyone has confirmation or the opposite, please comment this posting.

In short, to avoid potential problems, make sure your website for you custom websites are hosted on the same server as CRM. (please note that it is not supported to use the same website as CRM).

Gustaf Westerlund
CRM and SharePoint Consultant

Humandata AB