Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

org-mode and outlook integration.

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 el-get
Octocat-spinner-32 melpa
Octocat-spinner-32 README.org
Octocat-spinner-32 dir
Octocat-spinner-32 org-outlook.el
Octocat-spinner-32 org-outlook.info
README.org

org-outlook.el

Library Information

org-outlook.el — Outlook org

Filename
org-outlook.el

Description:

Author
Matthew L. Fidler

Maintainer:

Created
Mon May 10 09:44:59 2010 (-0500)
Version
0.8
Last-Updated
Tue May 29 22:21:06 2012 (-0500)
By
Matthew L. Fidler
Update #
166
URL
https://github.com/mlf176f2/org-outlook.el
Keywords
Org-outlook

Compatibility:

Introduction:

Org mode lets you organize your tasks. However, sometimes you may wish to integrate org-mode with outlook since your company forces you to use Microsoft Outlook. org-outlook.el allows:

  • Creating Tasks from outlook items:
    • org-outlook-task. All selected items in outlook will be added to a task-list at current point. This version requires org-protocol and org-protocol.vbs. The org-protocol.vbs has can be generated with the interactive function org-outlook-create-vbs.
  • Open Outlook Links in org-mode
    • Requires org-outlook-location to be customized when using Outlook 2007 (this way you don’t have to edit the registry).

This is based loosely on: http://superuser.com/questions/71786/can-i-create-a-link-to-a-specific-email-message-in-outlook

Note that you may also add tasks using visual basic directly. The script below performs the following actions:

  • Move email to Personal Folders under folder “@ActionTasks” (changes GUID)
  • Create a org-mode task under heading “* Tasks” for the file f:\Documents\org\gtd.org
  • Note by replacing “@ActionTasks”, “* Tasks” and f:\Documents\org\gtd.org you can modify this script to your personal needs.

The visual basic script for outlook is:


Sub CreateTaskFromItem()
    Dim T As Variant
    Dim Outlook As New Outlook.Application
    Dim orgfile As Variant
    Dim Pos As Integer
    Dim taskf As Object
    
    Set myNamespace = Outlook.GetNamespace("MAPI")
    Set myPersonalFolder = myNamespace.Folders.item("Personal Folders")
    Set allPersonalFolders = myPersonalFolder.Folders
    
    T = ""
    For Each Folder In allPersonalFolders
        If Folder.Name = "@ActionTasks" Then
            Set taskf = Folder
            Exit For
        End If
    Next
    
    If Outlook.Application.ActiveExplorer.Selection.Count > 0 Then
        For I = 1 To Outlook.Application.ActiveExplorer.Selection.Count
                Set objMail = Outlook.ActiveExplorer.Selection.item(I)
                Set objMail = objMail.Move(taskf)
                objMail.Save 'Maybe this will update EntryID
                T = T + "** TODO " + objMail.Subject + " :OFFICE:" + vbCrLf
                T = T + "[[outlook:" + objMail.EntryID + "][MESSAGE: " + objMail.Subject + " (" + objMail.SenderName + ")]]"
                T = T + vbCrLf + vbCrLf
                T = T + objMail.Body
                T = T + vbCrLf + vbCrLf
        Next
        ' Now that we have the org-mode tasks, add to org-mode file
        orgfile = GetFile("f:\Documents\org\gtd.org")
        Pos = InStr(1, orgfile, "* Tasks", vbTextCompare)
        orgfile = Mid(orgfile, 1, Pos + Len("* Tasks") + 1) + vbCrLf + T + Mid(orgfile, Pos + Len("* Tasks") + 1, Len(orgfile))
        orgfile = Replace(orgfile, vbCrLf, Chr(10)) ' Change to unix line endings.
        WriteFile "f:\Documents\org\gtd.org", orgfile
    Else
        MsgBox "No Message(s) Selected"
    End If
 
End Sub

Functions

Interactive Functions

org-outlook-create-vbs

(org-outlook-create-vbs)

Creates Visual Basic Code for Org-protocol

Internal Functions

org-outlook-open

(org-outlook-open ID)

Open the Outlook item identified by ID. ID should be an Outlook GUID.

org-protocol-do-outlook-capture

(org-protocol-do-outlook-capture INFO CAPTURE-FUNC)

Support org-capture and org-remember alike. CAPTURE-FUNC is either the symbol org-remember or org-capture.

org-protocol-outlook

(org-protocol-outlook INFO)

Process an org-protocol://outlook:// style url.

The sub-protocol used to reach this function is set in org-protocol-protocol-alist.

This function detects the Message ID, Subject, Sender and optional text separated by ‘/’. For example either

org-protocol://outlook:/ID/Subject/SenderName/SenderAddress

or

org-protocol://outlook:/o/ID/Subject/SenderName/SenderAddress

works.

By default, it uses the character org-protocol-outlook-default-template-key, which should be associated with a template in org-capture-templates.

To use this plugin:

  • Copy the outlook macro (below) into outlook
  • Modify the outlook capture template (o) to capture the email as a task. An example is below.

(“o” “org-outlook” entry (file “~/org/refile.org”) “* TODO Email %c %? %i %U” :clock-in t :clock-resume t)

You may also use the following placeholders

Placeholders Replacement %:link URL of the email %:description The title of the message %:title The title of the message %:initial Selected text. %:sender Sender’s name %:sender-email Sender’s Email

  • (optional) Modify the folder/location that outlook moves mail into (moving mail off the server changes the message ID. Once off the server, the ID remains the same unless you move it back…)
  • (optional) Modify the capture template used (I use `o’)
  • (optional) Make the macro CreateTaskFromItem accessable anywhere from outlook by adding it to the quick access toolbar and/or the standard toolbar.

Variables

Customizable Variables

org-outlook-capture

Capturing system for org-protocol outlook: subprotocol. Supports org-capture

org-outlook-location

  • Microsoft Outlook 2007 location.

org-protocol-outlook-default-template-key

Default template for org-capture or remember.

Internal Variables

org-outlook-dir

Org outlook directory

org-stored-links

Contains the links stored with org-store-link.

History

12-Dec-2012
Updated Visual Basic Script to be more robust, and have more options. (Matthew L. Fidler)
07-Dec-2012
Should fix Issue #1. Also added org-outlook-create-vbs to create the VBS code based on a user’s setup. (Matthew L. Fidler)
26-May-2012
Added (require ‘cl), Thanks Robert Pluim (Matthew L. Fidler)
21-Feb-2012
Bug fix for opening files. (Matthew L. Fidler)
21-Feb-2012
Bug fix. (Matthew L. Fidler)
13-Dec-2011
Added more autoload cookies. (Matthew L. Fidler)
08-Apr-2011
Added some autoload cookies. (US041375)
15-Feb-2011
Changed outlook-org to org-outlook.el (Matthew L. Fidler)
11-Jan-2011
Finalized interface with org-protocol (Matthew L. Fidler)
05-Jan-2011
Removed outlook copy. I only use from outlook now. (Matthew L. Fidler)
Something went wrong with that request. Please try again.