I need add calendar event when upload new document on Alfresco Share. It requires that the date field specified within the document (excel file) appears on the site calendar as an event. Does anyone know if this is possible?
It's all possible The real question is how tricky is it!
So firstly, your requirement has 3 elements: <ol><li>Parsing the XLS file to retrieve the date you're interested in</li> <li>Creating a calendar event</li> <li>Making both of these things happen when a relevant document gets uploaded</li>
Starting from the bottom and working up, creating the trigger to make things happen can be done either by a defining a rule & custom action or using a custom behaviour - a behaviour should be used when you the trigger to happen globally across the system and use a rule if you're only interested in doing it within a particular site or area. Both mechanisms can be configured to selectively use criteria to only fire when certain things are true (e.g. when an aspect is present, for certain content types, etc). Your behaviour/action acts as the plumbing where you define what to do when the trigger actually fires, so it's going to call the other two elements get their results and pass them their arguments etc. This is the least complex of the 3 elements
Next creating the calendar event. Alfresco calendar events are just nodes that you can create using a specific content type and putting it in the right location (like programmatically creating a document, but without having to add content). Each site has it's own calendar, so you'll first need to determine the site that your current document is in (you can use the SiteService.getSite(NodeRef) method for this) and the calendar entries all live under the "calendar" container of that site. Nicely though, Alfresco also provides the CalendarService to create new entries - you just pass it the site name and a CalendarEntryDTO object
If I understand you correctly, the date you wish to use for the event is stored within the excel file you're loading? How complex it will be to retrieve this will depend purely on how complex your spreadsheet is as well as how likely it is to change. You can use a library like Apache POI to read your excel file and extract your date