Solved

ms dynamics 4.0 - email with apostrophe in it

Posted on 2011-03-18
4
871 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
[X]
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
  • 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

Webinar: Aligning, Automating, Winning

Join Dan Russo, Senior Manager of Operations Intelligence, for an in-depth discussion on how Dealertrack, leading provider of integrated digital solutions for the automotive industry, transformed their DevOps processes to increase collaboration and move with greater velocity.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
error getting token from postman for dynamic 365 6 20
VB.NET Textbox input validation 4 66
SSIS GUID Variable 2 38
ASP.NET Built-In Report Creator / Viewer 5 25
Recently while returning home from work my wife (another .NET developer) was murmuring something. On further poking she said that she has been assigned a task where she has to serialize and deserialize objects and she is afraid of serialization. Wha…
Desired Skill Set for Microsoft Dynamics CRM Technical Resources – Part I
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

730 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