[英]Updating Dynamics CRM entries in C#
我试图找出如何在Dynamics CRM中更新数据,但失败了。
private const string Url = "*****/XRMServices/2011/OrganizationData.svc/";
private const string userName = "username";
private const string password = "password";
private readonly HttpClientHandler _handler;
NetworkCredential credentials = new NetworkCredential(userName, password);
_handler = new HttpClientHandler { Credentials = credentials };
public void Put()
{
StringContent content = new StringContent("<feed><entry><content><m:properties><d:Address1_Country>NEW VALUE</d:Address1_Country></m:properties></content></entry></feed>");
using (HttpClient client = new HttpClient(_handler))
{
client.PutAsync(Url + "AccountSet(guid'182df667-c4f6-e111-8042-0050568e0828')", content).Result;
}
}
我得到的答复是:
响应= {状态代码:415,ReasonPhrase:'不支持的媒体类型',版本:1.1,内容:System.Net.Http.StreamContent,标头:{DataServiceVersion:1.0; Persistent-Auth:true缓存控制:private日期:Tue,10 Mar 2015 10:22:07 GMT Server:Micr ...
您正在尝试使用在CRM Web资源之外无法使用的OData端点。 尝试出于您的目的使用SOAP端点: https : //msdn.microsoft.com/en-us/library/gg334754.aspx https://msdn.microsoft.com/en-us/library/gg328416.aspx
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.