Solved

ms dynamics 4.0 - email with apostrophe in it

Posted on 2011-03-18
4
856 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
Comment Utility
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
Comment Utility
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
Comment Utility
.
0
 
LVL 1

Author Closing Comment

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

thanks
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

This article describes relatively difficult and non-obvious issues that are likely to arise when creating COM class in Visual Studio and deploying it by professional MSI-authoring tools. It is assumed that the reader is already familiar with the cla…
Automatically creating a Trello card using data from a Microsoft Dynamics CRM record turned out to be an easy project that yielded great results.  Here's how I did this for an internal team at General Code.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

762 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now