微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

添加CrmService

第一次接触Crm,想通过调用WebService对实体进行访问,第一步就碰到难题了,获取CrmService对象一直不成功。因为对具体的参数涵义不了解,尝试花了不少时间。下面是自己的理解,最终尝试成功。

 

account newAccount = new account();
newAccount.name = "林*成";
newAccount.accountnumber = "123456";
newAccount.address1_postalcode = "351001";
newAccount.address1_city = "Xiamen";
newAccount.telephone1 = "15860727***";
newAccount.websiteurl = "http://www.***.com/";

// Set up the CRM Service.
CrmAuthenticationToken token = new CrmAuthenticationToken();
token.AuthenticationType = 0;
token.OrganizationName = "crm";// 该名字为安装Crm4.0指定组织名称时填写的
            
CrmService service = new CrmService();
service.Url = "http://192.168.5.233/mscrmservices/2007/crmservice.asmx";// 这个必须写
service.CrmAuthenticationTokenValue = token;
service.Credentials = System.Net.CredentialCache.DefaultCredentials;

service.Create(newAccount);  

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐