I have to adapt a Macro which is saving the current MailItem Selected in differents folders on Sharepoint Online site of my company: On Manual way we are well able to do SaveAs, and add the .msg file to Sharepoint folder by entering the URL of Sharepoint in the Address bar.
The idea is to have a macro like that:
'for each mail selected (but generally there is only one mail selected):
For Each olkMsg In Outlook.ActiveExplorer.Selection
'Many actions done to collect information from mail
'Save the email in Sharepoint
olkMsg.SaveAs "https://MyCompany.sharepoint.com/sites/MyTeam/Shared Documents/TestArchives/TestXXX.msg", olMSG
I tried by encoding the URL (It made disappeared the run time error -2147286788 (800300fc) but nothing is going to Sharepoint:
olkMsg.SaveAs "https%3A%2F%2FMyCompany.sharepoint.com%2Fsites%2FMyTeam%2FShared Documents%2FTestArchives%2FTestXXX.msg", olMSG
I tried the UNC path, it same to do not work on our Sharepoint on Microsoft Cloud:
olkMsg.SaveAs "\\MyCompany.sharepoint.com\sites\MyTeam\Shared Documents\TestArchives\TestXXX.msg", olMSG
I started to check if there is a way to add the file with ADODB.Recorset, but I'm completly lost if it can be a solution.
And on Internet, I'm just able to find solution to save Excel file on Sharepoint... I don't mind to have to proceed through an intermediate step as save file on a Temp file first and then transfer it to Sharepoint ( I tried as well without success, and I deleted the code I wrote...)
Thanks