First things first. You have to set up your Silverlight app to make a web services connection to CRM. The best tutorial I have found for this is located here in the MSDN:
http://msdn.microsoft.com/en-us/library/gg594452.aspx
Here is the call in C#:
//delete request
OrganizationRequest request = new OrganizationRequest() { RequestName = "Delete" };
EntityReference entrefDeleteTarget = new EntityReference();
entrefDeleteTarget.Id = new Guid("A42D83C5-5E61-E111-AC43-1CC1DEF1B5FF");
entrefDeleteTarget.LogicalName = "account";
request["Target"] = entrefDeleteTarget;
IOrganizationService service = SilverlightUtility.GetSoapService();
service.BeginExecute(request, new AsyncCallback(AccountDelete_ClickCallback), service);
You will notice that the biggest change in thinking and syntax will be that you have to specify your request and response properties as strings explicitly in code.
- I hope this helps!!
and the method AccountDelete_ClickCallback ?
ReplyDeleteservice.BeginExecute(request, new AsyncCallback(AccountDelete_ClickCallback), service);
ReplyDeleteHow to make the method AccountDelete_ClickCallback?
You just need to define it in code. It would be like:
Deleteprivate void AccountDelete_ClickCallback(IAsyncResult result)
{
}
I didn't include it because it's more of a generic thing you have to do when making asynchronous calls in .NET