+ Reply to Thread
Results 1 to 12 of 12

Outlook emails pulling attachments from Sharepoint

  1. #1
    Registered User
    Join Date
    06-23-2014
    Location
    MidWest, USA
    MS-Off Ver
    2016
    Posts
    89

    Outlook emails pulling attachments from Sharepoint

    Hello all,
    I have a script I built a couple years ago which creates emails in MS Outlook with predefined subject lines, addressees, and attachments. The end user can either run it to display or send. For 2 years it worked fine as I was referencing a simple shared folder for the required attachments. However, when my organization rolled out Sharepoint and upgraded the Office version we were on, the attachments started displaying as failed. I did of course update the file path to reference the Sharepoint Library the attachments were contained in. I do have permissions to that library and when I manually try to navigate to those locations, I have no problem doing so. The email still generates, but the file attachments display as "Download Failed" When I double click on them, it gives me a Retry option and when I select that the download actually succeeds.

    My code is below for your reference, and I'm attaching a screenprint of the email output.

    Please Login or Register  to view this content.
    Attached Images Attached Images

  2. #2
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    Office 365 ProPlus
    Posts
    5,770

    Re: Outlook emails pulling attachments from Sharepoint

    What's the value held in rngAttach1.Value & rngAttach2.Value?

    Is it "https://.../filename" or "\\Servername\...\filename"?

    If "https://...", try saving the link to local temp folder and then add the local file as attachment, instead of directly from SharePoint.
    “Progress isn't made by early risers. It's made by lazy men trying to find easier ways to do something.”
    ― Robert A. Heinlein

  3. #3
    Registered User
    Join Date
    06-23-2014
    Location
    MidWest, USA
    MS-Off Ver
    2016
    Posts
    89

    Re: Outlook emails pulling attachments from Sharepoint

    Yes, the values of those rngAttach1 and 2 are those links starting with "https://.

    How would the code look to save the sharepoint file to a local temp drive?

  4. #4
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    Office 365 ProPlus
    Posts
    5,770

    Re: Outlook emails pulling attachments from Sharepoint

    Depends. There are multiple ways to do it. But I tend to use Winhttp.

    I currently don't have SharePoint that I can test with. But try following.

    Please Login or Register  to view this content.
    If above works, you may want to turn it into function to be used in your actual module.
    Last edited by CK76; 12-18-2017 at 06:09 PM.

  5. #5
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    Office 365 ProPlus
    Posts
    5,770

    Re: Outlook emails pulling attachments from Sharepoint

    Alternative is to use urlmon code found in link below.
    https://stackoverflow.com/questions/...point-with-vba

    Note that you'll need to make it 64bit compatible, if you have 64bit Excel installed.

  6. #6
    Registered User
    Join Date
    06-23-2014
    Location
    MidWest, USA
    MS-Off Ver
    2016
    Posts
    89

    Re: Outlook emails pulling attachments from Sharepoint

    Thanks, I'll see if I can get these working here. May be a couple days, but I'll get back to you on results.

  7. #7
    Registered User
    Join Date
    06-23-2014
    Location
    MidWest, USA
    MS-Off Ver
    2016
    Posts
    89

    Re: Outlook emails pulling attachments from Sharepoint

    Sorry for the delay; I did finally get it working, although I used slightly different code than your example above. Thanks for the help!

  8. #8
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    Office 365 ProPlus
    Posts
    5,770

    Re: Outlook emails pulling attachments from Sharepoint

    Thanks for the update. Glad you got it solved.

  9. #9
    Registered User
    Join Date
    03-26-2019
    Location
    Paris
    MS-Off Ver
    2016
    Posts
    3

    Re: Outlook emails pulling attachments from Sharepoint

    Could you please share the code you used for your problem? Thanks a lot for sharing

  10. #10
    Registered User
    Join Date
    03-26-2019
    Location
    Paris
    MS-Off Ver
    2016
    Posts
    3

    Re: Outlook emails pulling attachments from Sharepoint

    My vba sripts bugs in the line whttp.send
    I do not know how to proceed
    Thanks

  11. #11
    Registered User
    Join Date
    06-23-2014
    Location
    MidWest, USA
    MS-Off Ver
    2016
    Posts
    89

    Re: Outlook emails pulling attachments from Sharepoint

    Sure thing! Here's the code I have right now. I just manually run it each month from Outlook.

    Please Login or Register  to view this content.

  12. #12
    Registered User
    Join Date
    03-26-2019
    Location
    Paris
    MS-Off Ver
    2016
    Posts
    3

    Re: Outlook emails pulling attachments from Sharepoint

    Thanks a lot! I have solved my problem

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Excel Macro to Send Multiple Emails w/ Attachments using MS Outlook 2007
    By arnel_10 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-17-2017, 08:09 PM
  2. VBA coding in Outlook 2010 to save attachments from emails
    By Ravipoojari in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-18-2015, 05:28 AM
  3. Accessing Outlook Attachments from Saved Emails
    By crunchKH in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-01-2013, 12:38 AM
  4. Macro to get the data exported to an excel from Outlook emails and or attachments?
    By lifeisaspreadsheet in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-07-2012, 04:31 PM
  5. outlook, attachments,sharepoint,excel usage
    By LiLi1 in forum Outlook Programming / VBA / Macros
    Replies: 0
    Last Post: 12-09-2011, 04:00 PM
  6. Excel to open workbook attachments in emails in Outlook subfolders
    By Julesdude in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-13-2010, 09:23 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1