获取“访问被拒绝”;同时在c#中使用SugarCRM SOAP API中的查询
本文关键字:SugarCRM SOAP 查询 API 访问 拒绝 访问被拒绝 获取 | 更新日期: 2023-09-27 18:12:39
我在c#中使用SugarCRM的SOAP API客户端。我在我的windows应用程序中添加了SugarCRM的Web Reference。我需要得到特定时间戳之前创建的线索列表。为此,我的做法如下:
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";
和whoaaa !这是工作. .