Uploading and Downloading documents from a Office Live Business Application using DAV/FPRPC
21 August 07 09:01 PM | Rohit Puri | 2 Comments   

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.
TechEd 2007
29 June 07 09:19 PM | Rohit Puri | 0 Comments   

Little late in posting about this. Was waiting on my friend to share pics he had taken :)

This was my first TechEd and was a blast!!!! It was great meeting all the people using and building on SharePoint. Getting their valuable feedback on SharePoint.

Here are some pics from the event.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

  ]

Attending TechEd 2007 in Orlando June 4-8
01 June 07 06:22 PM | Rohit Puri | 0 Comments   

I am looking forward to being at TechEd this year in Orlando and will be at the Windows SharePoint Services booth.

 

 

Develop for Microsoft Office Live
23 May 07 09:36 PM | Rohit Puri | 1 Comments   

OfficeLiveLogo

Learn about the opportunity that Office Live represents for developers at one of our upcoming Office Live reviews. 

  • Do you build software solutions and/or provide services to small business? 
  • Do you want to create an additional stream of income with a low technical barrier of entry? 
  • Are you interested in knowing how to take advantage of the shifting software plus services paradigm?
  • Then the Office Live Review for Micro ISVs is the event you should attend!

In June we are conducting two Office Live Review events:

· Tuesday, June 5th at the Microsoft Technical Center in Boston, Mass.

· Monday, June 11th at the Microsoft Technical Center in Silicon Valley, CA.

These one-day workshop focus on helping custom solution developers, web partners, and ISVs understand Microsoft’s Office Live strategy, how to customize and extend the Microsoft Office Live environment, and identify with Microsoft Office Live offerings – Office Live Basic, Office Live Collaboration, and Office Live Essentials, and what types of scenarios each of these apply to. 

As Michael Lehman posted in his blog, attendees will receive a free copy of Office 2007 Ultimate and Windows Vista Ultimate! The first 20 people to create an Office Live solution and post it to the Office Live Marketplace will also receive a Zune!

Use registration code: GENATT when you register for the events.

Agenda:

Start - Stop  Description

08:30 - 09:00 Arrival and registration

09:00 - 09:15 Welcome and logistics

09:15 - 10:00 Understanding the Office Live Architecture

10:00 - 11:00 Understanding the Office Live Data and Storage Architecture

11:00 - 12:00Using Workflows to Define Business Rules in Office Live Apps

12:00 - 13:00 Lunch

13:00 - 14:00 Programming with the Office Live Web Service API

14:00 - 15:00 Integrating with Office Live Authentication using Windows Live ID

15:00 - 15:15 Break

15:15 - 16:15 Build Office Live Integration using VS with Project GlidePath

16:15 - 17:15 Creating Mash-Ups in Office Live

My colleague Don Campbell and I will be leading these events, and I hope to see you there!

Microsoft Office Live Session at Mix 07
23 May 07 08:59 PM | Rohit Puri | 2 Comments   

 
 

mixbling At Mix 07 my colleague Don Campbell and I did a session about developer opportunities on Microsoft Office Live.

This was my first MIX and was AWESOME!!!

In short the session the following 2 developer opportunity areas on Office Live.

  • Creating custom Business Applications
  • Building Web 2.0 Mash Ups, and
  • Writing rich client WPF applications that connect to Office Live via Web services.

Thanks to everyone who came to our session and for the great feedback. 

You can get to the recording of the session at Microsoft Office Live Session at Mix 07

Few Pictures:

  

Upload/Download file to/from WSS document library using DAV
10 April 07 05:58 PM | Rohit Puri | 1 Comments   

I recently had to do this in an WPF client application.

Basically this is a static class that provides the following two methods

  • UploadFile - To upload a file to a WSS document library.
  • DownloadFile - To download a file from as WSS document library.
Usage:
DAVHelper.cs

using System;

using System.Collections.Generic;

using System.Text;

using System.IO;

using System.Web;

using System.Net;

using System.Data;

using System.Diagnostics;

namespace DAVWrapper

{

public static class DAVHelper

{

public static string UploadFile(string destUrl, string sourcePath)

{

try

{

Uri destUri = new Uri(destUrl);

FileStream inStream = File.OpenRead(sourcePath);

WebRequest req = WebRequest.Create(destUri);

req.Method = "PUT"

req.Headers.Add("Overwrite", "F");

req.Timeout = System.Threading.Timeout.Infinite;

req.Credentials = CredentialCache.DefaultCredentials;

Stream outStream = req.GetRequestStream();

string status = CopyStream(inStream, outStream);

if (status == "success")

{

outStream.Close();

WebResponse ores = req.GetResponse();

return "success"

}

else

{

return status;

}

}

catch (WebException we)

{

return we.Message;

}

catch (System.Exception ee)

{

return ee.Message;

}

}

public static string DownloadFile(string sourceUrl, string destFolder)

{

try

{

System.Uri sourceUri = new System.Uri(sourceUrl);

WebRequest req = WebRequest.Create(sourceUri);

req.Method = "GET"

req.Timeout = System.Threading.Timeout.Infinite;

req.Credentials = CredentialCache.DefaultCredentials;

WebResponse res = req.GetResponse();

Stream inStream = res.GetResponseStream();

FileStream fs = new FileStream(destFolder, FileMode.OpenOrCreate);

string status = CopyStream(inStream, fs);

if (status == "success")

{

inStream.Close();

return "success"

}

else

{

inStream.Close();

return status;

}

}

catch (WebException we)

{

return we.Message;

}

catch (System.Exception ee)

{

return ee.Message;

}

}

private static string CopyStream(Stream inStream, Stream outStream)

{

try

{

byte[] buffer = new byte[1024];

for (; ; )

{

int numBytesRead = inStream.Read(buffer, 0, buffer.Length);

if (numBytesRead <= 0)

break;

outStream.Write(buffer, 0, numBytesRead);

}

inStream.Close();

return "success"

}

catch (System.Exception ee)

{

return ee.Message;

}

}

}

}

Search

Go

This Blog

Tags

No tags have been created or used yet.

Syndication

Page view tracker