From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dirk-Jan C. Binnema Subject: Re: using org-mode with MS Outlook Date: Fri, 04 Mar 2011 08:10:55 +0200 Message-ID: <20110304061055.E7AE939C612@djcbsoftware.nl> References: Reply-To: djcb@djcbsoftware.nl Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: multipart/mixed; boundary="Multipart_Fri_Mar__4_08:10:55_2011-1" Return-path: Received: from [140.186.70.92] (port=42627 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PvOED-0000qi-C1 for emacs-orgmode@gnu.org; Fri, 04 Mar 2011 01:11:06 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PvOEB-0001Tf-NI for emacs-orgmode@gnu.org; Fri, 04 Mar 2011 01:11:05 -0500 Received: from vs14.mail.saunalahti.fi ([195.197.172.102]:37498) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PvOEB-0001TU-BS for emacs-orgmode@gnu.org; Fri, 04 Mar 2011 01:11:03 -0500 In-Reply-To: List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: David Ellis Cc: emacs-orgmode@gnu.org --Multipart_Fri_Mar__4_08:10:55_2011-1 Content-Type: text/plain; charset=US-ASCII Hi David, >>>>> On Thu, 3 Mar 2011 14:31:48 -0600, David Ellis ("DE") wrote: DE> I would like to move my calendar and task data from MS Outlook into DE> org files. I would like to know if anyone has done this and what is DE> the best way to do this. I know that MS Outlook can export to an DE> icalendar file. So, if there is an easy way to import that into and DE> org file, that will solve the calendar issue. I took a slightly different approach; when I get meeting-invitations etc., Exchange usually sends a message; so what I did was to write some code to parse these message and add the item to my org-calendar. The approach is a bit fragile, and there are quite a few cases which are not handled very well; still it may be useful; so find attached org-exchange-capture.el; ideas for improvements are welcome. Best wishes, Dirk. --Multipart_Fri_Mar__4_08:10:55_2011-1 Content-Type: text/plain; type=emacs-lisp; charset=US-ASCII Content-Disposition: attachment; filename="org-exchange-capture.el" Content-Transfer-Encoding: 7bit ;; org-exchange-capture.el, v0.0.1 ;; written by: Dirk-Jan C. Binnema ;; License: GPLv3+ (require 'org-capture) ;; turn the e-mails sent MS-Exchange about invitation/appointments into org-TODOs ;; using 'org-capture'. ;; The idea is that you select (mark) the parts of the email you want to add to ;; your org-todo item, and then invoke M-x org-exchange-capture-invitation ;; Some caveats: ;; - obviously, this is just a one-way copy, it won't make you 'accept' an ;; invitation, nor does it get any updates ;; - it seems to work with the emails I get from Exchange (I've encountered two ;; different kinds). But there may be more; at least the ones I get that are ;; in English, there are other versions as well. I'd be interested in ;; extending the regexps with more cases. ;; ;; - it does not take time-zones into account (yet) ;; ;; NOTE: ;; It does NOT handle yet: ;; When: 12.08.2010 12:00-14:00 (GMT+02:00) Helsinki, ... ;; When: \\([0-9]\\{2\\}\.[0-9]\\{2\\}\.[0-9]\\{4\\}\\) ;; When: 20. syyskuuta 2010 12:00-12:45 (GMT+02:00) Helsinki, .... ;; When: Occurs every Thursday effective 19.08.2010 from 14:00 to 15:30 ;; (GMT+02:00) Helsinki, ... ;; - it requires org-capture, which is fairly new; it should be easy to support ;; org-remember as well though. Also, I only tested with Wanderlust as e-mail ;; client; it *should* work with others as well though... ;; Note that that the message buffer must be the active buffer; ;; ie. it won't work in the 'Summary' (Wanderlust) (defun djcb-exchange-invite-time-to-org-date() "try to to find the Time/Date from an Exchange-invitation e-mail in the current buffer, and convert it into an org-mode date, or `nil' if it's not found." "get the time/date of an Outlook invite in org-mode notation" (let ((date) (time-begin) (time-end)) (save-excursion (save-match-data (beginning-of-buffer) (if (re-search-forward (concat "^When: \\([0-9]+ [a-z]+,? [0-9]\\{4\\}\\) " "\\([0-9]+:[0-9]+\\)-\\([0-9]+:[0-9]+\\)") nil t 1) (progn (setq date (parse-time-string (match-string-no-properties 1)) time-begin (match-string-no-properties 2) time-end (match-string-no-properties 3)) (format "<%d-%02d-%02d %s--%s>" (elt date 5) (elt date 4) (elt date 3) time-begin time-end)) (message "No match") nil))))) (defun djcb-exchange-invite-subject() "get the subject of an MS-Exchange invite e-mail in the current buffer" (save-excursion (save-match-data (beginning-of-buffer) (when (re-search-forward "^Subject: \\(.*\\)" nil t 1) (match-string-no-properties 1))))) (defun org-exchange-capture-invitation () "capture the MS-Exchange invite e-mail in buffer into an org-mode agenda item using the org-capture system. For this to work, you'll need to add to your `org-capture-templates' an item with a shortcut key of 'E', e.g. (\"E\" \"ExchangeInvite\" entry (file+headline \"todo.org\" \"Meetings\") \"* TODO %c\\n\") any text you select (mark) in the buffer will be added to to captured TODO; thus you can add the relevant details to the org TODO item. " (interactive) (let( (time (djcb-exchange-invite-time-to-org-date)) (title (djcb-exchange-invite-subject)) (txt (if (use-region-p) (buffer-substring-no-properties (region-beginning) (region-end)) ""))) (when time (kill-new (concat title " " time "\n\t" txt)) ;; hack: prepend to kill ring (org-capture nil "E")))) (provide 'org-exchange-capture) --Multipart_Fri_Mar__4_08:10:55_2011-1 Content-Type: text/plain; charset=US-ASCII -- Dirk-Jan C. Binnema Helsinki, Finland e:djcb@djcbsoftware.nl w:www.djcbsoftware.nl pgp: D09C E664 897D 7D39 5047 A178 E96A C7A1 017D DA3C --Multipart_Fri_Mar__4_08:10:55_2011-1--