简体   繁体   English

MS CRM 2013-通过网络服务更新机会

[英]MS CRM 2013 - Update Opportunity via web service

I wanted to establish a connection with MSCRM by calling their web service from visual studi and should be able to update an opportunity, if opportunity Id is provided. 我想通过从可视研究中心调用MSCRM来建立与MSCRM的连接,并且如果提供了机会ID,应该能够更新机会。

The whole process has to exposed as a web service. 整个过程必须作为Web服务公开。

Since I am new to MS technologies, having hard time figuring this out. 由于我是MS技术的新手,因此很难弄清楚这一点。

Downloaded some SDK from MS site. 从MS网站下载了一些SDK。 Couldn't achieve what I am expecting. 无法达到我的期望。

You can have a web reference to " http://servername/MSCrmServices/2007/CrmServiceWsdl.aspx " this points to your WSDL. 您可以通过Web引用“ http://servername/MSCrmServices/2007/CrmServiceWsdl.aspx ”来指向您的WSDL。

Then use your web reference to instantiate a new object of that type. 然后使用您的Web参考实例化该类型的新对象。

CrmDataService.opportunity oppty = new CrmDataService.opportunity();

Fill in the properties of the object Then use the service "Create" method to create the object. 填写对象的属性,然后使用服务“创建”方法创建对象。

DataService.Create(oppty);

There will be a minimum set of criteria to create the opportunity. 创造机会的标准最少。

This should guide you in the right direction to achieve this creation via the web-service instead of the SDK. 这应该指导您正确的方向,以通过Web服务而不是SDK来实现此创建。

If you have already downloaded the CRM 2013 SDK, it has the class already defined which can be reused to access the CRM from visual studio. 如果您已经下载了CRM 2013 SDK,则它已经定义了该类,可以重新使用该类以从Visual Studio访问CRM。

Please go to the folder "SDK\\SampleCode\\CS\\GeneralProgramming\\Authentication\\AuthenticateWithNoHelp" 请转到文件夹“ SDK \\ SampleCode \\ CS \\ GeneralProgramming \\ Authentication \\ AuthenticateWithNoHelp”

Refer to the file AuthenticateWithNoHelp.cs. 请参考文件AuthenticateWithNoHelp.cs。

Code in this class will help you to get the OrganizationService object which will expose you with the update method and you can do this as follows, 此类中的代码将帮助您获取OrganizationService对象,该对象将使用update方法向您公开,您可以按照以下步骤进行操作,

Entity entity=new entity("opportunity");
entity.Id=<Guid of the opportunity to update>;
service.Update(entity);

Assume that variable service is the OrganizationService object you have retrieved. 假定变量服务是您检索的OrganizationService对象。

This is applicable for both CRM 2011 and 2013. 这适用于CRM 2011和2013。

If you have not downloaded CRM 2013 yet, please get it from here( http://www.microsoft.com/en-in/download/details.aspx?id=40321 ). 如果尚未下载CRM 2013,请从此处获取它( http://www.microsoft.com/zh-cn/download/details.aspx?id=40321 )。 Hope this helps !!! 希望这可以帮助 !!!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM