This question has a reference to this SO thread.
For the sake of newness, I am using the following code to upload a file to DMS. Idea is to get the doc_id
doc_id