Open OneDrive documents and upload them to my repository

Add-in Express™ Support Service
That's what is more important than anything else

Open OneDrive documents and upload them to my repository
Open OneDrive documents and upload them to my repository 
Josep Llort Tella




Posts: 34
Joined: 2012-01-18
Hello

I have a Word add-in that allows me to upload the open document to a repository.
If I have the document on the local disk, it does it perfectly, but if I have the document in the cloud, for example in "OneDrive", I fail to upload it, since the active document acquires a remote route and not a local, causing an error:
"The format provided in the path is not supported"

To read the path of the active document I use the following lines of code:
Word.Document activeDocument = this.document;
String localFileName = activeDocument.FullName;


Can you help me with this?
Regards.
Posted 11 Mar, 2019 15:58:31 Top
Andrei Smolin


Add-in Express team


Posts: 18825
Joined: 2006-05-11
Hello Josep,

Are you saying that the exception occurs when you execute one of these lines?


Andrei Smolin
Add-in Express Team Leader
Posted 12 Mar, 2019 03:50:03 Top
Josep Llort Tella




Posts: 34
Joined: 2012-01-18
Hi Andrei,

No, that is, if I open a local document with Word activeDocument.FullName it takes a local value for example "C:\\ MyDocuments\\test.docx" and this allows my add-in to take the file and upload it to a repository, instead if the document that I open is in "OneDrive" it takes a remote value for example "https://onedrive.live.com/?id=5B320346DFC016BD%21146&cid=5B320346DFC014GT" this causes the error, since it is not a valid local path.

I do not know if they have any tool that allows me to download the OnDrive document and when it is opened with Word, acquire a local path or some other suggestion?
Posted 12 Mar, 2019 09:42:09 Top
Andrei Smolin


Add-in Express team


Posts: 18825
Joined: 2006-05-11
Hello Josep,

What codeline produces the exception?


Andrei Smolin
Add-in Express Team Leader
Posted 12 Mar, 2019 09:50:07 Top
Josep Llort Tella




Posts: 34
Joined: 2012-01-18
Hi,

I solved it, applying the saveAs(), I save the document on the local disk and with this, I can upload to my repository.
Thank you.
Posted 21 Mar, 2019 10:21:27 Top
Andrei Smolin


Add-in Express team


Posts: 18825
Joined: 2006-05-11
Welcome!


Andrei Smolin
Add-in Express Team Leader
Posted 22 Mar, 2019 01:41:00 Top