?
Solved

ms dynamics 4.0 - email with apostrophe in it

Posted on 2011-03-18
4
Medium Priority
?
886 Views
Last Modified: 2012-05-11
hi,

i am programatically creating a contact in crm 4.0.
i am using a windows service which calls into a wsdl generated proxy of the crm webservice.
it works fine - but when i create a contact which has an email address that contains an apostrophe. i.e

contact crmContact = new contact();
contact.emailaddress1 = "sean.o'brien@abc.com";
//add other properties...

//this is an instance of my proxy
crmService.create(crmContact);

it always falls over with the following soap exception:

2011-03-16 16:06:56,448 [7] ERROR  [(null)] - Soap Exception in :mywindowsservice Error : <error>
<code>0x80040216</code>
<description>An unexpected error occurred.</description>
<type>Platform</type>
</error>

I have tried escaping the apostrope with  sean.o\'brien@abc.com - but i still get the same exception.

thankyou very much.

0
Comment
Question by:MrKevorkian
  • 3
4 Comments
 
LVL 1

Accepted Solution

by:
smartapp earned 1000 total points
ID: 35164801
Hi,

As solution for the problem, you can call crmservice by replacing apostrophe bu others acceptable characters, for example :

contact.emailaddress1 = "sean.o-.-brien@abc.com";

And register a new Prestage plugins on create message on contact entity and replace -.- by the apostrophe '.

contact.emailaddress1 = contact.emailaddress1.Replace("-.-","'");

Hope this will solve your problem

Thanks
0
 
LVL 1

Assisted Solution

by:MrKevorkian
MrKevorkian earned 0 total points
ID: 35166042
hi,

thanks for your suggestion.  I have just figured out the problem!

basically just sending apostrophes through the webservice is actually fine.
but what i was doing in my code, before creating a contact - i was running a fetchxml query, to check that the contact email did not already exist.  And the apostrophe in the email was breaking the fetch x ml - so what i did was encode it

sean.o&apos;brien@abc.com
and this still retrieved sean.o'brien  at the crm end!

so it was the fetch query that was the problem.




0
 
LVL 1

Author Comment

by:MrKevorkian
ID: 35166057
.
0
 
LVL 1

Author Closing Comment

by:MrKevorkian
ID: 35196659
it was a really good suggestion, that got me thinking, which led to me solving my problem.

thanks
0

Featured Post

Veeam Disaster Recovery in Microsoft Azure

Veeam PN for Microsoft Azure is a FREE solution designed to simplify and automate the setup of a DR site in Microsoft Azure using lightweight software-defined networking. It reduces the complexity of VPN deployments and is designed for businesses of ALL sizes.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…
Suggested Courses

862 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question