c# - 在 C# 中的 SugarCRM SOAP API 中使用查询时获取 "Access Denied"

标签 c# api soap sugarcrm

我正在 C# 中使用 SugarCRM 的 SOAP API 客户端。 我在我的 Windows 应用程序中添加了 SugarCRM 的 Web 引用。 我需要获取在特定时间戳之前创建的潜在客户列表。为此,我这样做:

try
            {
                //Fields to retrieve
                string[] Lead_fields = new string[] { "id", "name", "phone_home", "phone_mobile", "phone_work", "phone_other", "phone_fax", "deleted" ,"gclid_c"};

                LastSyncDateTime = ReadLastSyncDateTime();
                DateTime dtTemp = TimeZone.CurrentTimeZone.ToUniversalTime(Convert.ToDateTime(LastSyncDateTime));
                string sDate = String.Format("{0:yyyy-MM-dd HH:mm:ss}", dtTemp);
                string L_date_created = sDate; //LastSyncDateTime;
                string Leads_query = "(Leads.date_modified  <= " + L_date_created + ") AND Leads.deleted = 0";

                //As on 2014.11.07 (getting exception : Access Denied)
                SugarCRM.get_entry_list_result_version2 Leads_result = SugarClient.get_entry_list(SessionId, "Leads", Leads_query, "", 0, Lead_fields, null, 30, 0, true);
                if (Leads_result.entry_list.Count() > 0)
                {
                    for (int i = 0; i < Leads_result.entry_list.Count(); i++)
                    {
                        MyLeads newLead = new MyLeads();
                        newLead.LeadId = Leads_result.entry_list[i].name_value_list[0].value;
                        MyLeadsList.Add(newLead);      
                    }
                }

            }
            catch (Exception ex) 
            {
                LogMessageToFile("ERROR : " + ex.Message.ToString());
            }

请注意,我能够以管理员身份成功登录。 请帮忙解决这个问题。

最佳答案

我成功了。没有任何可用的文档可以引导您走向正确的方向,但我只是做了一个猜测,并且它有效。 我刚刚引用了 L_date_created 字段。 因此查询将如下所示:

string Leads_query = "(Leads.date_entered  <= '" + L_date_created + "') AND Leads.deleted = 0";

哇哦!它正在工作..

关于c# - 在 C# 中的 SugarCRM SOAP API 中使用查询时获取 "Access Denied",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24710567/

相关文章:

ios - 如何使用 Yahoo Weather API 和我的 iPad 的纬度和经度获取当前天气状况?

r - 在 R 中验证 API

c# - 使用 appcmd 添加新网站问题

javascript - Javascript 与 C# 中的异步/等待

ruby-on-rails - trello api 自定义标签创建

php - 如何在 php5 中实现 ws-security 1.1

java - 尝试创建客户端服务库时 wsimport 失败

c# - 如何使用 SOAP 操作和 HttpClient 向经过授权的网络摄像头发送 ONVIF 请求

c# - 方法属性目标的目的是什么?

c# - Viewinjection 统一失败