Uploading and Downloading documents from a Office Live Business Application using DAV/FPRPC
It’s somewhat difficult to work with Front Page RPCs. We’ve heard this from folks, and I recently solved it for myself in a client app that uploads and downloads files from document libraries sitting in a custom business application in Microsoft Office Live.
I wrapped up the FPRPC and DAV code in a class library for use in any client application. Figured I should share this to save you some effort.
This Sample allows working with documents in a Office Live Business Application using FPRPC or DAV.
Note that this has not gone through testing and has no guarantees etc.
How to use the sample?
- Download Document Handler (FPRPC/DAV) Sample and extract all files.
- Re-add the reference to Microsoft.Windows.Live.Id
- Build the project.
- Output is a dll DocumentHandler.dll
- In your client application reference this and use it as follows.
string OfficeLiveFileURL = "https://mysitecom.officelive.com/Documents/documents/ClickToCall.doc"
string NewOfficeLiveFileURLDoc = https://mysitecom.officelive.com/Documents/documents/NewClickToCallDoc.doc
DocumentHandler.DocumentManager dm = new DocumentHandler.DocumentManager();
//BusinessName is your Business Application Name in
//Office Live that you want to use.
dm.BusinessName = "Document Manager"
dm.UserName = administrator@northwindinn.com
//This brings up the liveID sign on box to sign you in.
dm.SignIn();
//Use FPRPC
string result = dm.UploadFileViaRPC(NewOfficeLiveFileURLDoc, "C:\\LocalFile.doc");
result = dm.DownloadFileViaRPC(OfficeLiveFileURL, "c:\\LocalFile.doc");
//Use DAV
result = dm.UploadFileViaWebDAV(NewOfficeLiveFileURLDoc,
"C:\\LocalFile.doc");
result = dm.DownloadFileViaWebDAV(OfficeLiveFileURL, "C:\\LocalFile.doc");
- Build and Run.