2012-01-25 96 views

回答

0

就我所知,Salesforce并未直接公开日历对象,以便客户直接查询。

公共日历似乎落入023命名空间中,这是一个标准对象,但我无法在模式中找到具有该命名空间的任何对象,这使我相信SFDC已将它们隐藏起来。

+0

谢谢。我得出了同样的结论,但我们希望有一个解决方法!与此同时,我将创建一个自定义设置对象来存储日历ID。这只是一个管理的痛苦! – Bryan

1

如果您在ID上运行.getSobjectType(),它将作为日历对象出现。当您尝试查询该对象时,它说它不可用。它看起来像自定义设置是目前唯一的路线。

0

如果要在Visualforce中显示列表,可以在日历页面上使用PageReference GetContent()方法使用解决方法,然后从html中获取详细信息。

注意,这不会在APEX工作触发..

Public Class CalendarResource{ 
    public Id crId {get;set;} 
    public String label {get;set;} 
    public String type {get;set;} 
} 

Pagereference r = new PageReference('/_ui/common/data/LookupResultsFrame?lkfm=swt&lknm=cal&lktp=023&cltp=resource&lksrch=#'); 
String html = r.getContent().toString(); 
List<CalendarResource> cals = new List<CalendarResource>(); 

Matcher m = Pattern.compile('lookupPick\\(\'swt\',\'cal_lkid\',\'cal\',\'\',\'(.*?)\',\'(.*?)\',\'\',\'\'\\)">(.*?)</a></TH><td class=" dataCell ">(.*?)<\\/td><\\/tr>').matcher(html); 

//While there are labels 
while (m.find()) { 
    //system.debug(m.group(3)); 
    //system.debug(m.group(4)); 

    CalendarResource cr = new CalendarResource(); 
    cr.crId = m.group(1); 
    cr.label = m.group(2); 
    cr.type = m.group(4); 
    cals.add(cr); 
} 
for(CalendarResource cr : cals){ 
    system.debug(cr.crId+'__'+cr.label+'___'+cr.type); 
}