PDA

View Full Version : VBA save document to Web Service



dke01
08-30-2009, 06:41 PM
Hi,



I am writing a C# 3.5 MVC web application, with MS Office and SQL 2008.

Situation:
I need users to download a MS Word document from a web application, Edit it, then upload it back to the web applicaiton.


Ideal Solution:
Instead of making the user log back into the web app find the correct document they are editing and upload it again. I would like it to work similar to how SharePoint 2007 works.

I.e The user checks out the document on the server, so others are locked out of it (I can do this using server side code easily)
I then want the user to press save which will automatically use HTTP post to send the Binary version of the MS word document to the server which will save it (again the server side code for this is easy)

My VBA Questions

1) How can I use VBA code in the word document to send the saved document back to the server? I have looked at the WebServices toolkit and can see XMLHTTP object, but I am not sure if this works with binary data or just XML. Each search web search on the topic referes to older technology like SOAP Toolkit 3.0 and XMLHTTP3.0 what is the latest recommened way of doing this? I have created to methods in my VBA code

wsm_saveFile(ByVal ar_binaryData As Variant)
wsm_saveFileObj(ByVal any_binaryData As MSXML2.IXMLDOMNodeList)

But I do not know how to convert a Document into one of these types to send to the web service?
What I need is a method like ActivceDocument.getBytes ? does something like this exist?

2) I would need some paramaters to pass back in with the POST to the serve such as the UserID and DocumentID. How can I achive this? Can I use .NET code some how during the download to embed this information in the file some how (Prefeibily not the filename itself). So where the user cannot change it, In a hidden field? Meta data or VbA code? Can I edit VBA code using my Web App Server side code at run time?

p.s. I need a cross platform solution so writing dynamic FTP scripts is probably out of the question

I have also posted this question here
forums.asp.net/t/1465109.aspx