I do not use 'org-store-link' and 'org-insert-link' but a capture template, that automatically generates a link to the message (%a below). So you do not have to switch buffers to store a TODO entry:
(setq org-capture-templates '( ("m" "TODO from Mail" entry (file+headline "~/gitfiles/org/gtd.org" "Inbox") "* TODO %?, Link: %a")))
Since all my emails arrive in the INBOX and are archived in the folder "Archive" I can just use the following function which replaces the string 'INBOX' by 'Archive' in the Org mode link in the capture buffer:
(defun hs/replace () (interactive) (goto-char 1) (replace-string "INBOX" "Archive"))
This hook calls the function when I hit C-c C-c to file the capture entry:
(add-hook 'org-capture-prepare-finalize-hook 'hs/replace)
So, my workflow is as follows:
- Select a message in Summary buffer
- Hit C-c c m to capture a TODO item with Link to message and write a description (since the message is still in the inbox, the generated link contains the group "INBOX")
- Hit C-c C-c to file the TODO entry (this calls the function 'hs/replace' which replaces the string INBOX by Archive)
- Archive the email in the archive folder.
HTH