Detect Google Drive and OneDrive links in incoming mail


New Member
Outlook version
Outlook 2016 32 bit
Email Account
Exchange Server
Hello everyone! Security policies don't let me open Google Drive and OneDrive links at work, although I can see them on the email (don't ask... can't change that).

How can I detect this incoming emails to warn the sender that I didn't got his attached files? They believe the files arrived safe because no email is bounced and in fact the email arrived safely but not the attached files.

I can do that manually looking at each email but its a time consuming task. I saw that Google Drive shows as links that contains "" somewhere in the html and OneDrive are small files with .drv extension.

I would like to use VBA in Outlook to automatically send a reply with some predefined text replying that I didn't get those files and they must be sent as an attachment


Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
You can use a run a script rule or itemadd macro - i'd probably use instr function and look for keywords in the body

strbody = item.body
if instr(1,strbody, "") > 0 or if instr(1,strbody, ".drv") > 0 then
'send reply
end if
This page has a sample macro for sending the reply


New Member
Outlook version
Outlook 2016 32 bit
Email Account
Exchange Server
Thanks Diane! I'll further investigate since I need to apply it to emails already received. I'm using Access VBA from quite a long time, but Outlook's is a little bit different.

It seems that I would be some time reading all Outlook related things at to achieve what I want.

Is there any reading you can recommend me to get in touch with the Outlook VBA object model? Reading MS documentation right now but I mean real examples and not just properties and methods.

Thanks again!

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange had a lot of information but it's been offline for a while now.

Do you want to always run it yourself on selected messages? It's not difficult to change a run a script rule to manual - or to use both.

Use a 'stub macro' to trigger the script or replace 'YourMacroName objItem' with the code that does what you need. You need to make sure the object names match up - which you should know from Access VBA.

Sub RunScript()
Dim objApp As Outlook.Application
Dim objItem As Object ' MailItem
Set objApp = Application
Set objItem = objApp.ActiveExplorer.Selection.Item(1)

'macro name you want to run goes here
YourMacroName objItem

End Sub
Thread starter Similar threads Forum Replies Date
J Transport Rule to detect Keyword question.. Exchange Server Administration 2
T VBA outlook, detect priority emails Outlook VBA and Custom Forms 5
20 Ton Squirrel Detect Application_Startup event completion Outlook VBA and Custom Forms 1
M Outlook 2003 rule to detect a blank category Using Outlook 1
B Can not start Microsoft Office Outlook. Errors have been detect in the file. It said, close Outlook Using Outlook 1
P Outlook 2010 does not detect Proxy Settings with an ISA Client Using Outlook 2
G detect if a mail is read in a public folder Outlook VBA and Custom Forms 14
M Another way to detect if email read? Outlook VBA and Custom Forms 6
M how to detect duplicate email messages? Using Outlook 5
A how to detect email is saved to draft? Outlook VBA and Custom Forms 3
J Detect logoff/shutdown Outlook VBA and Custom Forms 1
H How to get BCM in OUtlook 2007 on Vista to detect my MDF file? BCM (Business Contact Manager) 1
GregS Outlook 365 blocked by Google popup Using Outlook 2
O Synchronising contacts Outlook 365 with Google v.v. Using Outlook 4
TomHuckstep Outlook 2016 Limit the number of days syncing from Google Calendar Using Outlook 1
B How to sync Outlook, iphone and Google calendars and contacts? Using Outlook 4
G Outlook VBA and Google Calendar ("Events") Outlook VBA and Custom Forms 1
D launching a link in google Using Outlook 1
Horsepower Google says Outlook 2016 is not a secure app Using Outlook 4
C Search with Google Macro? Outlook VBA and Custom Forms 4
N Importing Google contacts from CSV file removes recipient names in autocomplete list Using Outlook 0
M Google Apps Mail *SENT* from iPhone doesn't download to Outlook via POP3 Using Outlook 1
T bcc and Google imap Using Outlook 3
B synching outlook 2010 with google on android phone Using Outlook 6
C Odd error message not found in Google search Using Outlook 1
A Outlook 2013 IMAP using Google Mail App not syching Sent Mail Using Outlook 3
C Setting up Outlook 10 on Widows 8 using Google Server Using Outlook 3
A Recommend add-on or utility enabling quick Google search within Outlook Using Outlook 7
D Outlook/Google Configuration Using Outlook 27
S too difficult of a question to google Using Outlook 2
billzant RSS feeds and google Using Outlook 2
M How do I change the default map from Bing to Google in Outlook 2003? Using Outlook 23
I Links not working after un-installing Google Chrome Using Outlook 2
J Outlook Connector equivalent for Google Mail? Using accounts in Outlook 2
D Outlook 2010 registry hack - delete emails - Google Apps Using Outlook 0
R Outlook and google calendar stuck if I close outlook Using Outlook 1
C Sync Outlook Calendar and Google Calendar Using Outlook 1
L trying to download a google app that alows me to sync outlook with the droid x. Can you assist me in the process? Using Outlook 1
D syncing emails from google Using Outlook 4
H Lost ability to sync MS Outlook 2007 Calendar and Google Calendar Using Outlook 4
F Google Desktop fails to index Outlook 2010 Using Outlook 3
C Unlinking outlook with google calander Using Outlook 1
J importing google contacts into outlook Using Outlook 1
C Having issues with Google Desktop and Outlook 2010 mail: Using Outlook 1
S Broken hyperlinks by uninstalling Google Chrome! Using Outlook 2
J Contacts (sync'd with Google Apps) won't connect to address book Using Outlook 1
A Creating a shared calendar across small local network that also sync's with Google Calendar online Using Outlook 1
R MS Outlook will not connect to Google's mail system. Using Outlook 2
B Using Outlook 2007 (and 2003) running on Windows XP with Google Apps IMAP accounts getting "An unkno Using Outlook 1
M Problems receving Google mail (based in Greece) to Google mail (based in UK) via Outlook Using Outlook 1
Similar threads