<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <title>Get list of next Calendar Events via Liferay API</title>
  <link rel="self" href="https://liferay.dev/c/message_boards/find_thread?p_l_id=119785294&amp;threadId=515438" />
  <subtitle>Get list of next Calendar Events via Liferay API</subtitle>
  <id>https://liferay.dev/c/message_boards/find_thread?p_l_id=119785294&amp;threadId=515438</id>
  <updated>2026-04-20T14:25:00Z</updated>
  <dc:date>2026-04-20T14:25:00Z</dc:date>
  <entry>
    <title>RE: Get list of next Calendar Events via Liferay API</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=13190085" />
    <author>
      <name>Brett Conoly</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=13190085</id>
    <updated>2012-03-27T16:24:43Z</updated>
    <published>2012-03-27T16:24:43Z</published>
    <summary type="html">You can try something similar to this right now:&lt;br /&gt;&lt;br /&gt;    @SuppressWarnings({ &amp;#34;unchecked&amp;#34;, &amp;#34;rawtypes&amp;#34; })&lt;br /&gt;    private List&amp;lt;CalEvent&amp;gt; getEvents(ClientDataRequest portletRequest, RetrieveEventsAction action) throws SystemException {&lt;br /&gt;        ThemeDisplay themeDisplay = (ThemeDisplay) requestProvider.getPortletRequest().getAttribute(WebKeys.THEME_DISPLAY);&lt;br /&gt;        Long groupId = themeDisplay.getScopeGroupId();&lt;br /&gt;&lt;br /&gt;        DynamicQuery dynamicQuery = DynamicQueryFactoryUtil.forClass(CalEvent.class);&lt;br /&gt;        Conjunction primaryCriteria = RestrictionsFactoryUtil.conjunction();&lt;br /&gt;        primaryCriteria.add(PropertyFactoryUtil.forName(&amp;#34;startDate&amp;#34;).between(action.getStartDate(), action.getEndDate()));&lt;br /&gt;        primaryCriteria.add(PropertyFactoryUtil.forName(&amp;#34;groupId&amp;#34;).eq(groupId));&lt;br /&gt;        dynamicQuery.add(primaryCriteria);&lt;br /&gt;&lt;br /&gt;        return (List) CalEventLocalServiceUtil.dynamicQuery(dynamicQuery);&lt;br /&gt;    }</summary>
    <dc:creator>Brett Conoly</dc:creator>
    <dc:date>2012-03-27T16:24:43Z</dc:date>
  </entry>
  <entry>
    <title>RE: Get list of next Calendar Events via Liferay API</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=11278389" />
    <author>
      <name>GAURAV RASTOGI</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=11278389</id>
    <updated>2011-11-01T15:29:39Z</updated>
    <published>2011-11-01T15:29:39Z</published>
    <summary type="html">it sounds good..thnx..:-)</summary>
    <dc:creator>GAURAV RASTOGI</dc:creator>
    <dc:date>2011-11-01T15:29:39Z</dc:date>
  </entry>
  <entry>
    <title>RE: Get list of next Calendar Events via Liferay API</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=7087431" />
    <author>
      <name>Sreeraj AV</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=7087431</id>
    <updated>2011-01-13T12:46:51Z</updated>
    <published>2011-01-13T12:46:51Z</published>
    <summary type="html">Go to event_iterator.jspf &lt;br /&gt;&lt;br /&gt;1. Copy the selCal value to a new tempCalender Object&lt;br /&gt;&lt;br /&gt;2. start a for loop initialized with 0, its max limit &amp;#39;n&amp;#39; can be ur wish. &lt;br /&gt;&lt;br /&gt;3. replace CalEventLocalServiceUtil.getEvents&amp;#39;s Date object parameter with our new tempCalender Object. &lt;br /&gt;&lt;br /&gt;      --------&lt;br /&gt;      exixting code&lt;br /&gt;&lt;br /&gt;      --------&lt;br /&gt;&lt;br /&gt;4. atlast increment tempCalender&amp;#39;s Date field, repeat the loop&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;This ll display events from selectedDate/currentDate to selectedDate/currentDate + n days.</summary>
    <dc:creator>Sreeraj AV</dc:creator>
    <dc:date>2011-01-13T12:46:51Z</dc:date>
  </entry>
  <entry>
    <title>RE: Re: [Liferay Forums][3. Development]Get list of next Calendar Events vi</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=5539493" />
    <author>
      <name>William Chu</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=5539493</id>
    <updated>2010-08-11T00:29:35Z</updated>
    <published>2010-08-11T00:29:35Z</published>
    <summary type="html">I&amp;#39;m interested &lt;img alt="emoticon" src="@theme_images_path@/emoticons/laugh.gif" &gt;</summary>
    <dc:creator>William Chu</dc:creator>
    <dc:date>2010-08-11T00:29:35Z</dc:date>
  </entry>
  <entry>
    <title>RE: Re: [Liferay Forums][3. Development]Get list of next Calendar Events vi</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=4812807" />
    <author>
      <name>s s</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=4812807</id>
    <updated>2010-04-01T16:11:34Z</updated>
    <published>2010-04-01T16:11:34Z</published>
    <summary type="html">&lt;html&gt;&lt;head&gt;&lt;/head&gt;&lt;body&gt;Ok, figured out how to get a 'calendar' data type. I'm a boy-genius &lt;img alt="emoticon" src="@theme_images_path@/emoticons/glare.gif"&gt;&lt;br&gt;&lt;pre&gt;&lt;code&gt;#set ($realcal = $dateTool.getCalendar())&lt;/code&gt;&lt;/pre&gt;&lt;br&gt;If interest, I'll publish the working velocity when it gets that far. Gotta figure every website needs one of these right? Is it me or does our Liferay 'community' seem to need a breath of life?&lt;/body&gt;&lt;/html&gt;</summary>
    <dc:creator>s s</dc:creator>
    <dc:date>2010-04-01T16:11:34Z</dc:date>
  </entry>
  <entry>
    <title>RE: Re: [Liferay Forums][3. Development]Get list of next Calendar Events vi</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=4809780" />
    <author>
      <name>s s</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=4809780</id>
    <updated>2010-03-31T18:04:28Z</updated>
    <published>2010-03-31T18:04:28Z</published>
    <summary type="html">Hello, I got pretty far with an &amp;#39;events&amp;#39; web-content-display velocity based portlet (see picture/attachment; btw - is velocity a good idea for that? no portlet building skills) but also stuck at the point of needing to only see events from today forward. I thought those begin, end were dates so it was looking like a piece of cake. The type set to null retrieves all values (as Ray stated), begin/end of -1 gets everything as well.&lt;br /&gt;&lt;br /&gt;Plan B: looks like that service can be called with a date as the second parm. Date type &amp;#34;cal&amp;#34; - anyone know how to get/set that via velocity?</summary>
    <dc:creator>s s</dc:creator>
    <dc:date>2010-03-31T18:04:28Z</dc:date>
  </entry>
  <entry>
    <title>RE: Re: [Liferay Forums][3. Development]Get list of next Calendar Events v</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=2739767" />
    <author>
      <name>Lukas Matejka</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=2739767</id>
    <updated>2009-04-07T06:52:49Z</updated>
    <published>2009-04-07T06:52:49Z</published>
    <summary type="html">Is there any progress with this issue?</summary>
    <dc:creator>Lukas Matejka</dc:creator>
    <dc:date>2009-04-07T06:52:49Z</dc:date>
  </entry>
  <entry>
    <title>RE: Re: [Liferay Forums][3. Development]Get list of next Calendar Events v</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=1039856" />
    <author>
      <name>Tobias Amon</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=1039856</id>
    <updated>2008-07-07T12:30:41Z</updated>
    <published>2008-07-07T12:30:41Z</published>
    <summary type="html">Hello, &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;are there any news  regarding this topic. Has this item been implemented?</summary>
    <dc:creator>Tobias Amon</dc:creator>
    <dc:date>2008-07-07T12:30:41Z</dc:date>
  </entry>
  <entry>
    <title>Re: [Liferay Forums][3. Development]Get list of next Calendar Events via Li</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=543661" />
    <author>
      <name>Ray Augé</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=543661</id>
    <updated>2008-03-06T01:06:58Z</updated>
    <published>2008-03-06T01:06:58Z</published>
    <summary type="html">&lt;html&gt;&lt;head&gt;&lt;/head&gt;&lt;body&gt;&amp;gt; There also is the API:&lt;br&gt;&amp;gt; &lt;br&gt;&amp;gt; &lt;pre&gt;&lt;code&gt;CalEventLocalServiceUtil.getEvents(groupId, type, begin, end);&lt;/code&gt;&lt;/pre&gt;&lt;br&gt;&amp;gt; &lt;br&gt;&amp;gt; But I would need something like this not type specific. Also the begin and end parameters are int and I could't figure out what they are really doing.&lt;br&gt;&lt;br&gt;&lt;br&gt;The body of &lt;br&gt;&lt;pre&gt;&lt;code&gt;CalEventLocalServiceUtil.getEvents(groupId, type, begin,
end);&lt;/code&gt;&lt;/pre&gt;&lt;br&gt;is:&lt;br&gt;&lt;pre&gt;&lt;code&gt;	public List&amp;lt;calevent&amp;gt; getEvents(
			long groupId, String type, int begin, int end)
		throws SystemException {

		if (Validator.isNull(type)) {
			return calEventPersistence.findByGroupId(groupId, begin, end);
		}
		else {
			return calEventPersistence.findByG_T(groupId, type, begin, end);
		}
	}
&amp;lt;/calevent&amp;gt;&lt;/code&gt;&lt;/pre&gt;&lt;br&gt;&lt;br&gt;So, using &lt;br&gt;&lt;br&gt;CalEventLocalServiceUtil.getEvents(10023, null, 0, 1000); &lt;br&gt;&lt;br&gt;works fine. Problem is still that you can't specify a time interval.&lt;br&gt;I'll see if we can add this in as it really sounds reasonable.&lt;/body&gt;&lt;/html&gt;</summary>
    <dc:creator>Ray Augé</dc:creator>
    <dc:date>2008-03-06T01:06:58Z</dc:date>
  </entry>
  <entry>
    <title>Get list of next Calendar Events via Liferay API</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=515437" />
    <author>
      <name>Daniel Regli</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=515437</id>
    <updated>2008-02-26T08:24:52Z</updated>
    <published>2008-02-26T08:24:52Z</published>
    <summary type="html">&lt;html&gt;&lt;head&gt;&lt;/head&gt;&lt;body&gt;Hi&lt;br&gt;&lt;br&gt;I'm developing a small Portlet that is supposed to show me the next upcoming Events. The Events are normal CalEvents created with the liferay Calendar Portlet.&lt;br&gt;&lt;br&gt;So what I want to do is retrieve the events via the API (CalEventLocalServiceUtil.getEvents()). But I find the API is not very efficient. You seem to can only get the events for one day at a time. So if I want to look ahead 3 years into the future a would have 1095 API Calls and hence 1095 DB calls. Is there a more efficient way to do this?&lt;br&gt;&lt;br&gt;I'm thinking something where I can provide the groupID, start- and end-date and I get all Events in a list.&lt;br&gt;&lt;br&gt;There also is the API:&lt;br&gt;&lt;br&gt;&lt;pre&gt;&lt;code&gt;CalEventLocalServiceUtil.getEvents(groupId, type, begin, end);&lt;/code&gt;&lt;/pre&gt;&lt;br&gt;&lt;br&gt;But I would need something like this not type specific. Also the begin and end parameters are int and I could't figure out what they are really doing.&lt;/body&gt;&lt;/html&gt;</summary>
    <dc:creator>Daniel Regli</dc:creator>
    <dc:date>2008-02-26T08:24:52Z</dc:date>
  </entry>
</feed>
