MapaDelSitio CambiosRecientes Noticias ÁreaElisp WikiCómo
Jordania, Día de Independencia, Argentina, Día Nacional

OrgOutlook

Última vez editado

Modificado:

< * <b>Version </b> -- 0.7

a

> * <b>Version </b> -- 0.8

Borrado:

< Public Declare Function !ShellExecute Lib "shell32.dll" Alias "!ShellExecuteA" ( _
< !ByVal hWnd As Long, _
< !ByVal lpOperation As String, _
< !ByVal lpFile As String, _
< !ByVal lpParameters As String, _
< !ByVal lpDirectory As String, _
< !ByVal n!ShowCmd As Long) As Long
< 'Slightly Modified http://www.freevbcode.com/!ShowCode.Asp?ID=5137
< Function URLEncode(!EncodeStr As String) As String
< Dim i As Integer
< Dim erg As String
< erg = !EncodeStr
< ' *** First replace '%' chr
< erg = Replace(erg, "%", Chr(1))
< ' *** then '+' chr
< erg = Replace(erg, "+", Chr(2))
< For i = 0 To 255
< Select Case i
< ' *** Allowed 'regular' characters
< Case 37, 43, 48 To 57, 65 To 90, 97 To 122
< Case 1 ' *** Replace original %
< erg = Replace(erg, Chr(i), "%25")
< Case 2 ' *** Replace original +
< erg = Replace(erg, Chr(i), "%2B")
< Case 32
< erg = Replace(erg, Chr(i), "%20") 'org-protocol likes %20 instead of +
< Case 3 To 15
< erg = Replace(erg, Chr(i), "%0" & Hex(i))
< Case Else
< erg = Replace(erg, Chr(i), "%" & Hex(i))
< End Select
< Next
< URLEncode = erg
< End Function
< Sub !CreateTaskFromItem()
< Dim T As Variant
< Dim Outlook As New Outlook.Application
< Dim ie As Object
< Set ie = !CreateObject("!InternetExplorer.Application")
< Dim orgfile As Variant
< Dim Pos As Integer
< Dim taskf As Object
< Set myNamespace = Outlook.!GetNamespace("MAPI")
< ' Change this to be your personal folder item. If it remains
< ' on the server it keeps the Outlook ID originally given. If
< ' you move it to another folder, it will assign it to another
< ' ID, but keep that ID as long as you don't move it back to the
< ' server. (*sigh* I wish it kept the same ID.)
< ' Technically this is unnecessary, but with my limited exchange
< ' account size, I move my emails to "Personal Folders\@!ActionTasks" and
< ' then (possibly) refile from there.
< Set my!PersonalFolder = myNamespace.Folders.item("Personal Folders")
< Set all!PersonalFolders = my!PersonalFolder.Folders
< T = ""
< For Each Folder In all!PersonalFolders
< If Folder.Name = "@!ActionTasks" Then
< Set taskf = Folder
< Exit For
< End If
< Next
< ' End moving message.
< 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
< ' Note that o is the Outlook capture template.
< T = "org-protocol:/outlook:/o/" + URLEncode(objMail.!EntryID) _
< * "/" + URLEncode(objMail.Subject) _
< * "/" + URLEncode(objMail.!SenderName) _
< * "/" + URLEncode(objMail.!SenderEmailAddress)
< !ShellExecute 0, "open", T, vb!NullString, vb!NullString, vb!NormalFocus
< Next
< End If
< End Sub

Añadido:

> * <b>12-Dec-2012 </b> -- Updated Visual Basic Script to be more robust, and have more options. (Matthew L. Fidler)


Library Information

org-outlook.el — Outlook org

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:

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:

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 + "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:

(“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

Variables

Customizable Variables

org-outlook-capture

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

org-outlook-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

This was generated with OrgReadme. On updating the library, this page is likely to be replaced with updated content.