Add Service Reference to the Organization WCF service in the application.
URL àhttp://servername:port/OrganizationName/xrmServices/2011/organization.svc
Use the following code to perform various functions using OrganizationServiceClient
Entity myContact = new Entity();
AttributeCollection myAttColl = new AttributeCollection();
myAttColl.Add(new KeyValuePair<string, object>(“lastname”, “Rana”));
myContact.Attributes = myAttColl;
ClientCredentials credentials = new ClientCredentials();
Uri organizationUri = new Uri(“http://servername:port/organizationname/xrmServices/2011/organization.svc”);
try{
OrganizationServiceClient orgClient = new OrganizationServiceClient();
orgClient.Create(myContact);
}
catch (Exception ex){
}
Hope it helps.
Thanks Rana it helped me!
LikeLike
Hi Nishant,
Hope you are doing well.
I am trying to retrieve data from “CRM 2011” using “Organization” webservice.
Whenever I am trying to connect this webservice it gives “Server not found error Error”.
So my question is whether “CRM 2011” supported by “Windows Phone 7” or not?
Please help 😦
Thanks
Surojit
LikeLike
Hi, nice article.
However, when we try to add an address to an account, that we made up your way, it tells us we need to specify the ‘parentid’. We’ve done this, but then it throws an exception that the parentid cannot be NULL. Whilst debugging it doesn’t show that its null.
Can you help us out?
Barry
LikeLike
Hi Nishant
I am using OrganizationServiceClient. Any idea how to use WhoAmIRequest with it?
Thanks
LikeLike
Could someone show an example of how Incidents can be Resolved or Canceled using this service?
LikeLike
This code connects to CRM But I dont know how to close the incidents after Could someone help me?
Thanks
string crmServerUrl = “http://myserver/mygroup/”;
string connectionStringIntegrated = string.Format(“Url={0};”, crmServerUrl);
string connectionString = connectionStringIntegrated;
var connection = CrmConnection.Parse(connectionString);
using (var service = new OrganizationService(connection))
{
using (var crm = new CrmOrganizationServiceContext(service))
{
//Resolve Incidents and Cancel Incidents in here by passing in the incidentID
}
}
LikeLike
This post will help you Brian
http://community.dynamics.com/product/crm/crmtechnical/b/mileyja/archive/2011/08/02/close-a-case-using-jscript-or-net-in-microsoft-dynamics-crm-2011-with-closeincidentrequest.aspx
LikeLike
I found this will Close Incidents, However I still can not programatically close the associated activities.
Entity caseResolution = new Entity(“incidentresolution”);
caseResolution.Attributes.Add(“incidentid”, new EntityReference(“incident”, new Guid(“MYGUIDHERE”)));
caseResolution.Attributes.Add(“subject”, “testing programatic closing.”);
//service.Create(caseResolution);
Microsoft.Crm.Sdk.Messages.CloseIncidentRequest req = new Microsoft.Crm.Sdk.Messages.CloseIncidentRequest();
req.IncidentResolution = caseResolution;
req.RequestName = “CloseIncident”;
OptionSetValue o = new OptionSetValue();
o.Value = 5;
req.Status = o;
Microsoft.Crm.Sdk.Messages.CloseIncidentResponse resp = (Microsoft.Crm.Sdk.Messages.CloseIncidentResponse)service.Execute(req);
LikeLike
We need to close the related open activities also through code.
http://www.magnetism.co.nz/blog/roshan/12-02-16/Dynamics_CRM_2011_%E2%80%93_Closing_all_Related_Activities_for_a_Record.aspx
LikeLike
Everywhere, of course, with the exception of the
Hellenestic Greek States. This will probably come naturally, especially if you dominate the Ultralisk instead of letting it rampage on its own, since it gets
a rack of kills on its destruction run. With the amount of possibilities the demo
suggests, it would seem this is THE game to keep your peepers open for.
LikeLike
We have simply completed making War of Mercenaries Hack Device.
This is more about tabletop-game design theory with slight social discussion. Evil Genius is a very entertaining, if flawed, video game.
LikeLike