Posts Tagged document library

How to get the list of folders and subfolders from a SharePoint document library

There are many ways to get files & folder details from SharePoint (programmatically) but my manager asked me to provide the list of folders and sub folders from a SharePoint document library urgently. So I wanted get an idea to provide the information quickly, after spending few minutes on the web and found this post (I know about the DIR command but didn’t think about the SharePoint UNC). Yes, we can get the details using DOS command with UNC path. 🙂

First of all, we want to know about UNC and the DIR command.

UNC: Universal Naming Convention, a format for specifying the location of resources on a local-area network (LAN). Read more about this here.

Syntax: \\<servername>\<sharename>\<directory>

DIR: Display a list of files and subfolders. Read more about this here.

Syntax: DIR [pathname(s)] [display_format] [file_attributes] [sorted] [time] [options]

To get SharePoint UNC path, just remove http: from the SharePoint url and replace the forward slash with backslash. So my document library path is:


then it’s UNC will be like this:


Okay.. we will see the steps here, I have created a document library (StepBiStep) for testing purpose.

Step 1: Open the cmd prompt

Step 2: type the following statement in the command-line and press Enter key.

DIR /B /A:D / S [UNC Path] > [File Name]

/B -Bare format (no heading, file sizes or summary)
/A:D -Folder file attributes
/S -Include all subfolders
[UNC Path] -The path, which you want to get all the folders and subfolders
[File Name] -A text file name to store the folder details

So our command is looks like this, I have used a text file (FolderLists.txt, which is located in C: drive) to store the details.

DIR /b /A:D /S \\ServerName\doccenter\Administration\StepBiStep > c:\FolderLists.txt

Step 3: It will take few minutes to generate the list. You can open in a Notepad and see..!.

That’s all guys, enjoy!  I do welcome your comments. Please leave them here! 🙂






, , , , , , ,

Leave a comment

You do not have permissions to open this file on Excel Services OR Excel cannot load the workbook that you requested –SharePoint 2007

One of my colleagues sent an error message while using the development site of SharePoint 2007 in my office and I figured out the configuration of “Excel Calculation Services” was not done properly. It’s a very simple set-up, here we go:

1. Make sure that “Excel Services” (Actually “Excel Calculation Services”) is running. To check this out please do the following steps:

Central Administration –> Operations under “Topology and Services” click “Services on server” 

On the table below we can see the “Excel Calculation Services” is started. So it’s running 🙂

2. Make sure that, file access method of “Excel Services Settings” is using “Process Account”, instead of the Impersonation. To do this, follow these steps:

Go to Central Administration –> Home

On the left menu, under “Shared Services Administration” Select your “Shared Services” (for me SharedServices2 but default SharedServices1)

Under “Excel Services Settings” click the “Edit Excel Services Settings” 

Change the file access method to “Process Account”.

3. Finally make the following changes on the Trusted file locations under “Excel Services Settings”. Here are the steps:

Go to the “Shared Services” under “Excel Services Settings” click the ”Trusted file locations”.

You will be navigating to the Excel Services Trusted File Locations page. Then click “Add Trusted File Location”.

In the Location pane, do the following:

– Address: In this field we can enter a Document library or full portal Url (I have given Document library path). Please note: Don’t use like http://server:1010/documentlibrary1/forms/default.aspx instead of http://server:1010/documentlibrary1

– Location Type: For this field we have to select the “Windows SharePoint Services” option

– Trust Children: Ensure whether we need to be trusted the child libraries or directories, here I selected “Children Trusted”

Then click OK, that’s all! It is working huh! 🙂




, , , , , , , , ,