Listing files and file summary information (title, subject, author) from a folder on a remote server (same domain)

I am running MS Visual Web Dev 2008 Express and I have found some code that lists files in a remote directory (see below).  This list is for a list of PDF files.  The listing works except for the links, but I will leave that for another question.  

I want the file list to show "title", "subject", "author" as well (this information can be viewed / changed if you right click on a file in windows explorer and choose the Summary tab).

I found code on codeproject.com (http://www.codeproject.com/KB/cs/ntfsstreams.aspx) that is supposed to allow this listing (I could not attach the zip file, so you will have to download it).  

How can I use this code in my file listing to show file summary information?
<%@ Page Language="vb" AutoEventWireup="false" %>
<%@ Import Namespace="System.IO" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>File Listing with Summary Info</title>
 
    <style type="text/css">  
    body,td,th { font-family:tahoma;font-size:8pt }
    a {text-decoration:none;}
    </style>  
</head>
<body>
<%
    Dim directory As String = "\\server-02\documents\intranet\safety & labels"
    Dim dirInfo As New DirectoryInfo(directory)
 
    articleList.DataSource = dirInfo.GetFiles("*.*")
    articleList.BorderWidth = 0
    articleList.DataBind()
%>
    
    <asp:DataGrid runat="server" id="articleList" Font-Names="Verdana" Width="100%"
        AutoGenerateColumns="False" AlternatingItemStyle-BackColor="#eeeeee"
        HeaderStyle-BackColor="Gray" HeaderStyle-ForeColor="White" AllowSorting="true"
        HeaderStyle-Font-Size="10pt" HeaderStyle-Font-Bold="True" Font-Size="10pt" CellPadding="4" BorderWidth="0">
 
      <Columns>
        <asp:HyperLinkColumn DataNavigateUrlField="Name" DataTextField="Name" HeaderText="File Name" />
        <asp:BoundColumn DataField="LastWriteTime" HeaderText="Last Write Time" ItemStyle-HorizontalAlign="Center" DataFormatString="{0:d}" />        
        <%--<asp:BoundColumn DataField="CreationTime" HeaderText="Created" DataFormatString="{1:d}" />--%>
        <asp:BoundColumn DataField="Length" HeaderText="File Size" ItemStyle-HorizontalAlign="Right" DataFormatString="{0:#,### bytes}" />  
      </Columns>
 
    </asp:DataGrid>  
 
    
</body>
</html>

Open in new window

mark1perAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Bob LearnedCommented:
I set a DataGrid (in 3.5 a GridView would be better), that has columns defined, and it is bound to the directory.  I am confused what you are really looking for.
0
mark1perAuthor Commented:
Hello TheLearnedOne: I don't mean to sound trivial, but I will explain the data I am referring to for you and for anyone else trying to understand what I mean ...

Open an Explorer Window, right click on a *.pdf file, in the Dialog box click on Properties, then click the Summary tab.  In the Summary tab you will see fields listed: Title, Subject, Author, etc.  Then add data to those fields (if not already populated) and click OK.  Then, in the original Explorer Window, right click on the column heading and click More... (at the bottom).  Check Title, Subject, Author then click OK.  You then should see the information that you entered in the columns.  See attached screen shot.

It is this information that I wish to extract and display in my ASP page / DataGridView.

file-summary-screenshot.gif
0
Bob LearnedCommented:
I don't know if this will help you, but I have this managed wrapper class that I worked on a while ago, that borrowed from the DSOFile COM library to get document summary information.

Reference:
The Dsofile.dll files lets you edit Office document properties when you do not have Office installed
http://support.microsoft.com/?id=224351


// Source:
// The Dsofile.dll files lets you edit Office document properties when you do not have Office installed
// http://support.microsoft.com/?id=224351
 
using DSOFile;
using System;
using System.Runtime.InteropServices;
 
public class DocumentSummaryReader : IDisposable
{
 
    private OleDocumentProperties _DocumentProperties = null;
 
    public DocumentSummaryReader(string fileName)
    {
 
        // Open the OLE document file from the disk.
        _DocumentProperties = new OleDocumentProperties();
 
        _DocumentProperties.Open(fileName, true, dsoFileOpenOptions.dsoOptionDefault);
    }
 
    public SummaryPropertyInfo GetDocumentSummary()
    {
        SummaryPropertyInfo info = new SummaryPropertyInfo();
      
        info.ApplicationName = _DocumentProperties.SummaryProperties.ApplicationName;
        info.Version = _DocumentProperties.SummaryProperties.Version;
        info.Subject = _DocumentProperties.SummaryProperties.Subject;
        info.Category = _DocumentProperties.SummaryProperties.Category;
        info.Company = _DocumentProperties.SummaryProperties.Company;
        info.Keywords = _DocumentProperties.SummaryProperties.Keywords;
        info.Manager = _DocumentProperties.SummaryProperties.Manager;
        info.LastSavedBy = _DocumentProperties.SummaryProperties.LastSavedBy;
        info.WordCount = _DocumentProperties.SummaryProperties.WordCount;
        info.PageCount = _DocumentProperties.SummaryProperties.PageCount;
        info.ParagraphCount = _DocumentProperties.SummaryProperties.ParagraphCount;
        info.LineCount = _DocumentProperties.SummaryProperties.LineCount;
        info.CharacterCount = _DocumentProperties.SummaryProperties.CharacterCount;
        info.CharacterCountWithSpaces = _DocumentProperties.SummaryProperties.CharacterCountWithSpaces;
        info.ByteCount = _DocumentProperties.SummaryProperties.ByteCount;
        info.PresentationFormat = _DocumentProperties.SummaryProperties.PresentationFormat;
        info.SlideCount = _DocumentProperties.SummaryProperties.SlideCount;
        info.NoteCount = _DocumentProperties.SummaryProperties.NoteCount;
        info.HiddenSlideCount = _DocumentProperties.SummaryProperties.HiddenSlideCount;
        info.MultimediaClipCount = _DocumentProperties.SummaryProperties.MultimediaClipCount;
        info.DateCreated = this.ParseDate(_DocumentProperties.SummaryProperties.DateCreated);
        info.DateLastPrinted = this.ParseDate(_DocumentProperties.SummaryProperties.DateLastPrinted);
        info.DateLastSaved = this.ParseDate(_DocumentProperties.SummaryProperties.DateLastSaved);
        info.TotalEditTime = _DocumentProperties.SummaryProperties.TotalEditTime;
        info.Template = _DocumentProperties.SummaryProperties.Template;
        info.RevisionNumber = _DocumentProperties.SummaryProperties.RevisionNumber;
        info.IsSharedDocument = _DocumentProperties.SummaryProperties.SharedDocument;
 
        if (_DocumentProperties.IsOleFile)
        {
            info.ClsId = new Guid(_DocumentProperties.CLSID.ToString());
            info.ProgId = _DocumentProperties.ProgID;
            info.OleDocumentFormat = _DocumentProperties.OleDocumentFormat;
            info.OleDocumentType = _DocumentProperties.OleDocumentType;
        }
 
        return info;
    }
 
    private DateTime ParseDate(object value)
    {
        DateTime result;
 
        if (value != null)
        {
            if (DateTime.TryParse(value.ToString(), out result))
                return result;
        }
        return DateTime.MinValue;
    }
 
 
    #region IDisposable Members
 
    public void Dispose()
    {
        _DocumentProperties.Close(false);
 
        Marshal.ReleaseComObject(_DocumentProperties);
    }
 
    #endregion
}
 
public class SummaryPropertyInfo
{
    public string ApplicationName;
    public string Version;
    public string Subject;
    public string Category;
    public string Company;
    public string Keywords;
    public string Manager;
    public string LastSavedBy;
    public int WordCount;
    public int PageCount;
    public int ParagraphCount;
    public int LineCount;
    public int CharacterCount;
    public int CharacterCountWithSpaces;
    public int ByteCount;
    public string PresentationFormat;
    public int SlideCount;
    public int NoteCount;
    public int HiddenSlideCount;
    public int MultimediaClipCount;
    public DateTime DateCreated;
    public DateTime DateLastPrinted;
    public DateTime DateLastSaved;
    public int TotalEditTime;
    public string Template;
    public string RevisionNumber;
    public bool IsSharedDocument;
    public Guid ClsId;
    public string ProgId;
    public string OleDocumentFormat;
    public string OleDocumentType;
 
}

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Bob LearnedCommented:
Example usage:

            using (DocumentSummaryReader reader = new DocumentSummaryReader(@"c:\my documents\compliance table.doc"))
            {
                SummaryPropertyInfo properties = reader.GetDocumentSummary();
            }

0
Bob LearnedCommented:
The DSOFile library lets you read and write properties, but I just went down the road of a read-only class, so there is a way, if you want to have a DocumentSummaryWriter class.  I just didn't need anything like that at the time.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.