0
我跟随此链接“https://prabirchoudhury.wordpress.com/2013/06/13/retrieve-microsoft-crm-2011-data-using-fetchxml-and-web-service/”并连接到CRM。C#代码连接CRM保存视图
在下面的链接是连接到用户创建的视图的代码。
string fetchXml = @"<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='false' count='100'>
<entity name='account'>
<attribute name='ownerid' />
<attribute name='name' />
<attribute name='accountnumber' />
<attribute name='accountid' />
<order attribute='accountnumber' descending='true' />
<link-entity name='systemuser' to='owninguser' alias='mainuser'>
<attribute name='systemuserid'/>
<attribute name='domainname' />
<attribute name='fullname' />
</link-entity >
</entity>
</fetch>";
如果你看到我必须通过XML代码从CRM中获取数据,但是我只是想通过视图名称和csv文件而不是传递XML代码的形式获取数据。我在Powershell中做了同样的事情,但我需要在C#代码中做同样的事情。
我只想传递视图名称的原因是因为明天用户将在视图中进行任何修改,并且如果用户进行任何更改,我不必触摸代码,因此我需要使其成为动态的,其次获取数据如何在缓冲区上创建csv文件(无需在机器上进行物理创建),然后导出到任何基于云的服务。
你可能对[Reflection]感兴趣(https://msdn.microsoft.com/en-in/library/mt656691.aspx) –
@AmitKumarGhosh:为什么要反思?他只需要将他的对象“序列化”为XML并调用适用的Web服务? – garfbradaz
@ harshu288您可以提供关于您如何与Web服务交流的代码。我知道你提供了链接,但是你的实现细节会很有帮助。 – garfbradaz