Office 365 Direct Email - Possible Solution

I have inquired previously about the possibility of creating a Hook to a specific Office 365 email using Outlook Web Access.

I found this answer to how to create the required URL. “Solution 1” works well.

Is it possible to use this information to write a Script so that this URL can be utilized by Hook?

1 Like

Thank you, @rkaplan. I had a quick look and this seems doable and would be worthwhile! (I haven’t discussed it with the dev team yet, but I’ve updated the ticket accordingly.)

1 Like

That would be awesome. I moved to Outlook when my firm’s case management system released an Outlook add-in. Right now, I’m doing the song and dance in the link in the post from @rkaplan. Would be awesome if I could use Hook instead.

@Evan

I still hope this can be added to Hook - that would be the easiest solution

But in the interim I figured out a workaround using Keyboard Maestro instead of Zapier:

2 Likes

@rkaplan Thanks for sharing this! I’m going to check it out first thing when I get to the office this morning.

Thank you so much for sharing this, @rkaplan. I had to tweak it somewhat – for some reason my Office 365 links looked a little different than yours – but I have it working. I couldn’t get it working for items in a user-created folder, as the link included some symbols inserted in the middle of it, and my regex isn’t strong enough to figure out how to remove them. But I just act on items in my archive, inbox, and sent items anyway. Thanks again.

Excellent - glad to hear that helped

1 Like

a dev here proposed this, should anyone want to try this version:

tell application "Safari"
        set d to first item of documents
        set u to URL of d
        if u contains "https://outlook.office.com/mail/inbox/id/" then
                set AppleScript's text item delimiters to "https://outlook.office.com/mail/inbox/id/"
                set messageID to text item 2 of u
                return "https://outlook.office.com/owa/?ItemID=" & messageID & "&viewmodel=ReadMessageItem&path=&exvsurl=1"

        end if
        return u

end tell

if it works we can adapt it to other browsers.

Thanks @LucB

That works fine to get the URL in Safari - is there a way for the title of the Hook to be set to the title of the email?

You’d need to open the email in its own tab, then call Hook to Copied Link. This is because MS does not expose the title in the message list view (or whatever MS calls it).

Here is a revised script:

tell application "Safari"
	set d to first item of documents
	set u to URL of d
	set outlookUrl to "https://outlook.office.com/mail/inbox/id/"
	if u contains "https://outlook.office.com/mail/inbox/id/" then
		set AppleScript's text item delimiters to "https://outlook.office.com/mail/inbox/id/"
		set messageID to text item 2 of u
		if messageID contains "?" then
			set AppleScript's text item delimiters to "?"
			set messageID to text item 1 of messageID
		end if
		
		return "https://outlook.office.com/owa/?ItemID=" & messageID & "&viewmodel=ReadMessageItem&path=&exvsurl=1"
		
	end if
	return u
end tell

We’re looking into a solution that would be browser-agnostic.

Thanks

Any chance to allow us to Edit the name of a Recent or Pinned item? I think that would be simpler and also be helpful in many other use cases.

That’s implemented internally and we expect it in 2.1, pending QA.

1 Like

I played around with this for a few minutes, and, assuming I’m doing it correctly, it works great on messages in the Inbox, but not on messages in the Archive, Sent Items, or other folders. It’s quite possible, though, that it’s user error on my part.

I know it is possible to get links in standard Office 365 folders, as I have a Keyboard Maestro macro that grabs links from any standard folder (Archive, Deleted Items, Sent Items, etc.), and reformats them so they can be re-opened later. (I can’t get it to work with custom folders, though).

1 Like

We need to revise the script to reflect the format of the URL for other mailboxes - in my KM Forum post I noted that this Regex replace solves that - we need to do something similar for the Hook script:

image

1 Like