It's working only for rootsite domain.sharepoint.com and not for any of the site collections. I don't get any errors(creation, connection, none), the code goes through all the commands and there is completely no result in the SPO library. Tested on 2 tenants with the same results. Will run more tests and keep you updated.
– grishaNov 24 '14 at 12:29

Works :) I still have an error when opening those documents in Word Online:"sorry word online ran into a problem opening this document. To view this document...", which seems similar to my original issue :/ Error occurs regardless of the browser and doesn't appear for the files I upload manually. Tested also with Excel files SpreadsheetDocument.Create(...). The .doc and .xls extensions don't open at all. .docx and .xlsx give the error in Web Apps and open empty in local Office. If I open them locally and then save, they will be viewable/editable online later.
– grishaNov 25 '14 at 8:32

1

Just updated the answer (results section). It's hard to say why this error occurs in your case, but after running the script provided in answer i got this result
– Vadim GremyachevNov 27 '14 at 21:47

1

Works, not sure why :) When I figure it out, I'll delete this comment and post a more useful one. Thank you, Vadim!
– grishaNov 28 '14 at 9:37