SiteData.EnumerateFolder Method

Returns information about the files and folders within a folder on a SharePoint site.

Web Service: Site DataWeb Reference: http://<Site>/_vti_bin/SiteData.asmx

Syntax

<SoapDocumentMethodAttribute("http://schemas.microsoft.com/sharepoint/soap/EnumerateFolder", RequestNamespace:="http://schemas.microsoft.com/sharepoint/soap/", ResponseNamespace:="http://schemas.microsoft.com/sharepoint/soap/", Use:=SoapBindingUse.Literal, ParameterStyle:=SoapParameterStyle.Wrapped)> _
Public Function EnumerateFolder ( _
    strFolderUrl As String, _
    <OutAttribute> ByRef vUrls As _sFPUrl() _
) As UInteger

Dim instance As SiteData
Dim strFolderUrl As String
Dim vUrls As _sFPUrl()
Dim returnValue As UInteger

returnValue = instance.EnumerateFolder(strFolderUrl, vUrls)
[SoapDocumentMethodAttribute("http://schemas.microsoft.com/sharepoint/soap/EnumerateFolder", RequestNamespace="http://schemas.microsoft.com/sharepoint/soap/", ResponseNamespace="http://schemas.microsoft.com/sharepoint/soap/", Use=SoapBindingUse.Literal, ParameterStyle=SoapParameterStyle.Wrapped)] 
public uint EnumerateFolder (
    string strFolderUrl,
    out _sFPUrl[] vUrls
)

Parameters

  • strFolderUrl
    A string that contains the site-relative URL of the folder.
  • vUrls
    Returns an array that contains information about the files and folders, including their URLs, the date and time that each item was last modified, and a Boolean value that specifies whether the item is a folder.

Return Value

A 32-bit unsigned integer that returns 0 to indicate that the operation has completed.

Example

The following code example displays the URL of each file in a folder, as well as the date and time that it was last modified. This example assumes the existence of a label within the form of a Windows Application.

Dim srvSiteData As New Web_Reference_Name.SiteData()
srvSiteData.Credentials = System.Net.CredentialCache.DefaultCredentials

Dim enArray() As Web_Reference_Name._sFPUrl

srvSiteData.EnumerateFolder("Doc_Lib/Folder", enArray)

Dim en As Web_Reference_Name._sFPUrl

For Each en In enArray

    If Not en.IsFolder Then

        label1.Text += en.Url.ToString() + " :: " + en.LastModified.ToString() + ControlChars.Lf

    End If

Next en
Web_Reference_Name.SiteData srvSiteData = new Web_Reference_Name.SiteData();
srvSiteData.Credentials = System.Net.CredentialCache.DefaultCredentials;

Web_Reference_Name._sFPUrl[] enArray;

srvSiteData.EnumerateFolder("Doc_Lib/Folder", out enArray);

foreach (Web_Reference_Name._sFPUrl en in enArray)
{
    if (!en.IsFolder)
    {
        label1.Text += en.Url.ToString() + " :: " + en.LastModified.ToString() + "\n";
    }
}

See Also

Reference

SiteData Class
SiteData Members
Site Data Web Service