Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

ms dynamics 4.0 - email with apostrophe in it

Posted on 2011-03-18
4
870 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 250 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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
VB.NET 2008 Publish Error 2 34
No Data for DropDown List 2 28
how to just get time from a date 6 33
Where does legacy ASP.NET initialize language? 2 26
For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

829 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