none
Programmatically save O365 Outlook attachments to either OneDrive or a local file system RRS feed

  • Question

  • .csv files are emailed as attachments every 15 minutes to an Outlook email account in Office 365.  I would like to save each of these .csv files to a folder on either One Drive or to a folder on a local file system.  How can this be accomplished through PowerShell?
    • Moved by Bill_Stewart Tuesday, February 24, 2015 3:26 PM Move to more appropriate forum
    Tuesday, February 24, 2015 1:56 PM

Answers

All replies

  • Can you post your script?  What have you tried?

    You can look at the script her for one that may help: https://gallery.technet.microsoft.com/ScriptCenter/


    ¯\_(ツ)_/¯

    • Marked as answer by maugust Tuesday, February 24, 2015 9:33 PM
    Tuesday, February 24, 2015 3:26 PM
  • I'd suggest asking Office 365 specific questions on the SharePoint or Exchange dev forums instead. The current forum is for Microsoft Office Outlook (not Office 365).
    Tuesday, February 24, 2015 3:32 PM
  • The answer is the same for both Office 2013 and O365  excluding OWA.

    We can use VBA to do this very easily.  It can also be done with PowerShell and VBScript.  Ther eis no trick to doing this in any version of Outlook.

    Look in script gallery for examples of saving attachments: https://gallery.technet.microsoft.com/scriptcenter/site/search?f%5B0%5D.Type=RootCategory&f%5B0%5D.Value=Office&f%5B0%5D.Text=Office&f%5B1%5D.Type=SubCategory&f%5B1%5D.Value=Microsoft%20Outlook&f%5B1%5D.Text=Microsoft%20Outlook


    ¯\_(ツ)_/¯

    Tuesday, February 24, 2015 4:02 PM
  • > The answer is the same for both Office 2013 and O365  excluding OWA.

    If you differentiate MS Office 2013 and O365 - the latter doesn't provide VBA (OWA).

    So, the steps for uploading attachments will be different depending on the environment where the attachment come from. If is located in the Outlook installed on the machine, VBA can be used.

    In other cases a REST API should be used.

    Tuesday, February 24, 2015 4:15 PM
  • Outlook 2013 for O365 sure does have a complete copy of VBA. I use it all of the time.

    Office 365 is Office 2013 with a web back end and Office web apps.  All Office 2013 applications are completely web integrated.

    If you don't want to use Outlook or VBA the we can use EWS with O365.


    ¯\_(ツ)_/¯

    Tuesday, February 24, 2015 4:19 PM
  • I know what Office 365 is for and how it works.

    Based on the initial post, the task is to download attachments from OWA (Office 365) and save them to a local folder or to an OneDrive account. In that case I'd recommend asking such questions on the Exchange Server Development  forum instead. That is the right place for EWS specific questions.

    Tuesday, February 24, 2015 4:24 PM
  • I know what Office 365 is for and how it works.

    Based on the initial post, the task is to download attachments from OWA (Office 365) and save them to a local folder or to an OneDrive account. In that case I'd recommend asking such questions on the Exchange Server Development  forum instead. That is the right place for EWS specific questions.

    Not what it says. Go back and read carefully:

    "emailed as attachments every 15 minutes to an Outlook email account in Office 365"

    It clearly states an Outlook email account in Office 365.  There is no mention of an OWA restriction. 

    The latest version of O365/OWA can be optioned to save all attachments to your OneDrive automatically.  But that is not what was asked.


    ¯\_(ツ)_/¯


    • Edited by jrv Tuesday, February 24, 2015 4:27 PM
    Tuesday, February 24, 2015 4:27 PM
  • There is no mention of an OWA restriction. 

    > on a local file system

    What files can be saved to a local file system? :)

    I'd suggest clarifying before posting answers.

    Tuesday, February 24, 2015 4:32 PM
  • There is no mention of an OWA restriction. 

    > on a local file system

    What files can be saved to a local file system? :)

    I'd suggest clarifying before posting answers.

    All attachments in Outlook can be saved to the local file system.  Outlook has been able to do this for decades. Why would you think that it can't be done?

    I simple mentioned that the latest O365/OWA can save to OneDrive. OneDrive is on the local file system.  It will be replicated ot all systems attached OneDrive.  I use this all of the time.  All of my scripts and files are on OneDrive.  I can access OneDrive from any system including my phone and all of my IE settings are shared among system via OneDrive.

    We can use Outlook or EWS to save file to the local system, OneDrive or SharePoint very easily.


    ¯\_(ツ)_/¯

    Tuesday, February 24, 2015 4:38 PM
  • > Why would you think that it can't be done?

    I didn't say so. A different technology should be used in case of OWA (EWS) which is a subject for another forum.

    Tuesday, February 24, 2015 5:04 PM
  • > Why would you think that it can't be done?

    I didn't say so. A different technology should be used in case of OWA (EWS) which is a subject for another forum.

    You keep posting about OWA.  OWA is not a factor here.  EWS is NOT OWA.  EWS works with Exchange 2007 and later.  O365 is Exchange 2013.  OWA is a SharePoint application that runs on SharePoint and makes Exchange visible in a Web Browser.  EWS does not require OWA or SharePoint.

    I know all of this is very confusing but once sorted it is quite obvious what each pieces is and how they are related.  O365 is just Exchange/AD/IIS on the Azure platform (or a customized version of it)  with some added bells and whistles.

    We have had the same access over time with MSN and Hotmail.  Now all are on full Exchange.  I have systems that have Office installed from MSN as a subscription.  All have VBA and all work either on  the desktop or on the web.  We can switch between web and desktop seamlessly.  O465 also has added live collaboration so we can co-edit Word and Excel documents.  Amazingly VBA and Net continue to work across all products.  Of course the new effort is always from and towards Net.  All new tools are being built in PowerShell.

    So it is time to get out of the old 20th century sneaker-net version of Windows and get you head in the clouds. ...

    I know. Your mother said "Eugene! Get you head out of the clouds."  but in this century mothers everywhere are saying "Eugene! Get your head into The Cloud if you want to be a success."

    The Cloud is mostly just a way of thinking.  Same hardware and same software.  It just sits on a bigger network.


    ¯\_(ツ)_/¯

    Tuesday, February 24, 2015 5:17 PM
  • jrv,

    OMG I just stop posting to this forum thread until the asker provides the details.

    > EWS works with Exchange 2007 and later.  O365 is Exchange 2013.  OWA is a SharePoint application that runs on SharePoint and makes Exchange visible in a Web Browser.  EWS does not require OWA or SharePoint.

    If you take a look at my first reply there, you will see that I recommended more appropriate forums for these technologies (SharePoint and Exchange Server dev). You want to cover a lot of different things in the single forum.

    Tuesday, February 24, 2015 5:25 PM
  • The question is about Outlook VBA or a scripting method to get Outlook to save attachments.   I don't know why you think that requires all of this.

    Just use VBA and the SaveAttachments call or look at the PowerShell scripts in the Gallery that extract attachments to a local or network drive. Why is that so much of a debate an why do you keep insisting that the answer has to do with OWA.  I only posted that info to help you undersztand the realationships between these products. 

    We can create a solution in Net, VBScript, PowerShell, VBA.  Why does that require going to the O365 forum for an answer?

    I object to the move of this thread from the scripting forum as any script technology can do this.


    ¯\_(ツ)_/¯

    Tuesday, February 24, 2015 5:40 PM
  • There is no need to explain what each technology stands for... Anyway, just a simple question:

    How can we use VBA if Outlook/Office is not installed on machine?

    The asker is looking for a powershell script to download attachments.

    And please stop explaining evident things to me, I am not the asker.

    Tuesday, February 24, 2015 5:51 PM
  • The OP is asking about Outlook.  The assumption is that it is installed.  If you have a quesiotn about howto do this then you really should start a new topic with your question.


    ¯\_(ツ)_/¯

    Tuesday, February 24, 2015 5:53 PM
  • I don't see any word where Outlook is mentioned as installed on the PC. 

    The assumption is that it is installed.

    That is why the thread is so long..

    Tuesday, February 24, 2015 5:59 PM
  • I don't see any word where Outlook is mentioned as installed on the PC. 

    The assumption is that it is installed.

    That is why the thread is so long..

    I want to run notepad in Windows 7.  How do  I do it.

    Don't assume that I am actually an owner of Windows 7 or that I even know what I am talking about.  All is a mirage.


    ¯\_(ツ)_/¯

    Tuesday, February 24, 2015 6:07 PM
  • This link led me to: https://gallery.technet.microsoft.com/scriptcenter/O365-Email-Attachments-to-6a45e84c.  Thank you.

    Tuesday, February 24, 2015 9:42 PM
  • Yes - that uses EWS to capture mail items and attachments from Exchange online (O365).  I find it easier to do with PowerShell and Outlook but if it needs to be scheduled then EWS is usually the better solution.

    ¯\_(ツ)_/¯

    Tuesday, February 24, 2015 9:52 PM
  • As you may see I was right about the question. Outlook is not involved.
    Wednesday, February 25, 2015 8:03 AM
  • As you may see I was right about the question. Outlook is not involved.

    A logically incorrect assumption.  Outlook was involved but a different solution of the two I proposed was chosen.  THat is why I proposed other than just Outlook. OWA was not involved or mentioned but anyone but you.

    Learning how to use complex logic as a thought device takes a bit of experience.  You should read some Sherlock Holmes to get a sense of how it works.  I can also recommend "Symbolic Logic" by Charles Dobson (AKA Lewis Carroll).  It will help to discipline your logical thinking away from hopeful guesswork.

    ;)


    ¯\_(ツ)_/¯

    Wednesday, February 25, 2015 1:02 PM
  • As you may see I was right about the question. Outlook is not involved.

    A logically incorrect assumption.  Outlook was involved but a different solution of the two I proposed was chosen.  

    If you try to re-read the question you may see that Outlook was not mentioned. 

    There was no need to choose the answer, it was obvious ;)

     
    Wednesday, February 25, 2015 1:30 PM
  • As you may see I was right about the question. Outlook is not involved.

    A logically incorrect assumption.  Outlook was involved but a different solution of the two I proposed was chosen.  

    If you try to re-read the question you may see that Outlook was not mentioned. 

    There was no need to choose the answer, it was obvious ;)

     

    Now you are just being weird.  The title and the question state Outlook explicitly.  I think you are just jerking our collective chain.  Have a good day being weird.

    ¯\_(ツ)_/¯

    Wednesday, February 25, 2015 1:42 PM