1

How can I display a shared drive/folder in the browser? This is for a company intranet. Ideally, I'd like users to be able to click a file (ppt, excel, word) and have it open in office.

I've done something similar by embedding a sharepoint site in an iframe but I don't need the entire site, just the folder containing the files.

I don't want to manually enter the file paths because this folder may be updated and the new files should display automatically.

I'm using C# but an example in any language will be appreciated.

Kara
  • 6,115
  • 16
  • 50
  • 57
iliketolearn
  • 670
  • 3
  • 8
  • 25
  • 1
    I haven't tried anything. I'm not sure where to start. I've seen this done before just don't know how. – iliketolearn Nov 06 '13 at 14:30
  • After a quick search, list files: http://stackoverflow.com/questions/6047228/listing-folders-in-a-directory-using-asp-net-and-c-sharp access a shared folder with user/password: http://stackoverflow.com/questions/1232120/c-how-to-logon-to-a-share-when-using-directoryinfo – Ovidiu Nov 06 '13 at 14:33
  • 1
    http://www.codeproject.com/Articles/8881/Web-File-Manager – P.Brian.Mackey Nov 06 '13 at 14:34

3 Answers3

2

The System.IO namespace should have all that you need.

var myFiles = Directory.GetFiles(@"\\10.0.0.1\myFolder\test\")

To display it in ASP.NET, check out Listing Folders in a Directory using asp.net and C#

Community
  • 1
  • 1
crthompson
  • 15,653
  • 6
  • 58
  • 80
2

This is done by using WebDav, which is a network protcol. It's implemented in sharepoint but it's not depending on sharepoint, but if i remember correctly, the dll that's used is called Sharepoint.ddl. I have no real experience using Webdav but there some frameworks to help you out. Maby http://sourceforge.net/projects/webdav/ is something that fit your needs.

Heres a link to a webdav that a colleague tried and liked http://www.webdavsystem.com/server Note that Webdav also opens up the support for "live" saving and editing files, so you don't have to reupload the file to the server.

Binke
  • 897
  • 8
  • 25
0

Quick code in ASP.NET based on Listing Folders in a Directory using asp.net and C#.

Doesn't handle user permissions.

<%@ Import Namespace="System.IO" %>

<% foreach (var file in new DirectoryInfo(@"\\Path\To\Share").GetFiles())
{ %>
    <a href="<%= file.FullName %>"><%= file.Name %></a>
    <br />
<% } %>  
Community
  • 1
  • 1
Ovidiu
  • 1,407
  • 12
  • 11