Erika Ehrli - Adventures with Office Products & Technologies
MSDN & TechNet: Releasing Office, SharePoint, Exchange & Lync Centers and content for developers and IT professionals.

How to Upload Files to SharePoint Server 2007 from ASP.NET Web Applications

How to Upload Files to SharePoint Server 2007 from ASP.NET Web Applications

  • Comments 6

Some time ago I  blogged about How to: Uploading a File to a SharePoint Library Site from a Local Folder and How to: Magic with SharePoint 2003, uploading files using a Web service. Some people found these samples useful and some people asked if I could provide sample code that works with SharePoint Server 2007.

For some time I asked around and realized that there are multiple possible ways to accomplish this task in SharePoint 2007. Here are some popular approaches I’ve learned about and some great possibilities and drawbacks for each:

  • Copy Web service (Copy.asmx): The Copy Web service provides services for copying files within a SharePoint site and between SharePoint sites. Some people have created great samples that show you how to use this Web service to “upload” files while having some control over content types and metadata. This approach actually copies content from one SharePoint site to another, which is great, but may not be the best option if you want to upload files from your local drive to a SharePoint site.
  • Imaging Web Service (Imaging.asmx): This Web service provides methods that enable you to create and manage picture libraries. This WS has an upload method that allows you to upload different files (including non-image files) to SharePoint Image libraries (only) on the current Web site.  However, you can’t use this Web service to upload files to a regular document library (Shared Documents).
  • HTTP PUT method: There’s a third option that allows you to upload files (any file type) from your local drive to a predefined SharePoint list by using the HTTP PUT method. This method is simple and you don’t need to create SharePoint code to upload files. However, for the same reason, you won’t have programmatic control over file metadata on SharePoint lists. It’s super useful though, and I believe this is the best possible way (that I know of so far) to upload files to SharePoint Server 2007.

For this last approach, Joel Krist has created a new Office Visual How-to that shows how to use the HTTP PUT method to programmatically upload files from an ASP.NET Web application to a Microsoft Office SharePoint Server 2007 site: Uploading Files to SharePoint Server 2007 from ASP.NET Web Applications by Using the HTTP PUT Method. This article provides code samples in both VB and C# and a video that shows how to this.

Here’s a preview of the video from that same article.

Enjoy!

Leave a Comment
  • Please add 4 and 1 and type the answer here:
  • Post
  • A common scenario involves moving files from a Microsoft ASP.NET Web application to a Microsoft Office Share Point Server 2007 site. Office Share Point Server provides the Copy Web service for copying files between Share Point sites or within a Share Point site, and the Imaging Web service for uploading files to Share Point image libraries. However, neither Web service supports generic file uploading to Share Point Server. This Office Visual How-To shows you how to programmatically upload files to a predefined Share Point list by using the HTTP PUT method.

  • I like the option of the HTTP PUT as it is rather simple in its approach.  How is security handled at the application layer with the puts?

  • Dear Sirs,Administration,

    I represent the company SecretsLine LTD, My nfvt is Slava, our company selling  VPN accesses.

    Do you know that in the U.S. and European country work laws about piracy? People are afraid to download movies and music in the Internet.

    I have project https://secretsline.biz/en/partners/  .

    Your customers will be able to download movies anonymous.Therefore not be brought to justice.I want to talk to you about partnership.

    Our company 3 years, we have large quantity of servers worldwide ,Partner Program for 2 years.

    Clients of our service people who shook free music or movies very much, so that your resource has targeted traffic to our service.

    When a person is registered to you, he always assigned to you and all the time how much he will pay, you'll have %.

    It is waiting for your response, I hope for long cooperation.

    Contact me by ICQ: 769838

    Or E-mail: bingoguide@secretsline.biz

    Best Regards,

    CEO Vyacheslauv Tabola

    SecretsLine Ltd.

  • Hi,

    Thanks for info related to "How to Upload Files to SharePoint Server 2007 from ASP.NET Web Applications"

    very helpul post.

    Cheers!

  • There's nothing enjoyable about this post, sorry.

    Method 1. The Copy Web Service in SP 2007 doesn't allow uploading from an external machine.

    Method 2. The Imaging Web Service documentation is out of date, the sample code simply doesn't work for SP 2007. (i.e. the Imaging class no longer exists, it appears to have been replaced with ImagingSoapClient)

    Method 3. The PUT method is useless to me as it copies to SharePoint Lists - these are of no interest to me.

    I've heard that they've FINALLY fixed this in the 2010 product, but why is such a basic "bread & butter" operation be seemingly impossible in SharePoint 2007? Amazing!

  • There's nothing enjoyable about this post, sorry.

    Method 1. The Copy Web Service in SP 2007 doesn't allow uploading from an external machine.

    Method 2. The Imaging Web Service documentation is out of date, the sample code simply doesn't work for SP 2007. (i.e. the Imaging class no longer exists, it appears to have been replaced with ImagingSoapClient)

    Method 3. The PUT method is useless to me as it copies to SharePoint Lists - these are of no interest to me.

    I've heard that they've FINALLY fixed this in the 2010 product, but why is such a basic "bread & butter" operation be seemingly impossible in SharePoint 2007? Amazing!

Page 1 of 1 (6 items)