Delete Entity Record

public

 

 

void DeleteContactInformation(string _contactid)

{

 

ServerConnection serverConnect = newServerConnection();

 

ServerConnection.Configuration config = serverConnect.GetServerConfiguration();

 

OrganizationServiceProxy _serviceProxy;

 

var creds = newClientCredentials();

 

using (_serviceProxy = newOrganizationServiceProxy(config.OrganizationUri,

config.HomeRealmUri,

config.Credentials,

config.DeviceCredentials))

{

 

// This statement is required to enable early-bound type support.


_serviceProxy.ServiceConfiguration.CurrentServiceEndpoint.Behaviors.Add(

 

newProxyTypesBehavior());

 

IOrganizationService service = (IOrganizationService)_serviceProxy;

_serviceProxy.EnableProxyTypes();

 

List<Contact> _contacts;

 

using (Microsoft.Crm.Sdk.CustomService.serviccontext srv = new Microsoft.Crm.Sdk.CustomService.serviccontext(_serviceProxy))

{

_contacts = srv.ContactSet.Where(a => a.ContactId ==

 

newGuid(_contactid)).ToList();

 

if (_contacts.Count() > 0)

{

 

Contact _contact = _contacts[0];

srv.DeleteObject(_contact);

srv.SaveChanges();

}

}

}

}

 

 

This entry was posted in MS Dynamic CRM 2011. Bookmark the permalink.

6 Responses to Delete Entity Record

  1. Reclaim PPI says:

    Most I can point out is, I am not sure what to say! Except obviously, for the excellent tips that are shared on this blog. I will think of a million fun methods to read the articles or blog posts on this site. I do believe I will eventually take action with your tips on that matter I could not have been able to take care of alone. You are so innovative to permit me to be one of those to benefit from your useful information. Please realize how considerably I enjoy the whole thing.

  2. aging says:

    We really appreciate your site post. There are actually hundreds of techniques we could put it to very good use with the help of a minimum of effort in time and money. Thank you very much pertaining to helping make the post answer many issues we have had before now.

  3. We pretty much appreciate your website post. There are lots of techniques we could put it to great use with minimal effort in time and capital. Thank you so much for helping make the post give light to many queries we have had before now.

  4. I can’t thank you enough for the posts on your web site. I know you add a lot of time and effort into these and hope you know how deeply I appreciate it. I hope I am able to do the same for someone else sometime.

  5. Most I can say is, I am not sure what to really say! Except of course, for the excellent tips that are shared within this blog. I am able to think of a zillion fun ways to read the articles on this site. I’m sure I will at last take action employing your tips on that matter I could never have been able to handle alone. You are so considerate to allow me to be one of those to profit from your helpful information. Please see how great I enjoy the whole thing.

  6. I can’t thank you fully for the content on your web-site. I know you add a lot of time and effort into them and truly hope you know how deeply I appreciate it. I hope I am able to do the identical thing for another man or woman one of these days.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>