GetDetailsOf Method

Retrieves details about an item in a folder. For example, its size, type, or the time of its last modification.

Syntax

sDetail = Folder.GetDetailsOf(vItem, iColumn)

Parameters

vItem Required. The item for which to retrieve the information. This must be a FolderItem object.
iColumn Required. An Integer value that specifies the information to be retrieved. The information available for an item depends on the folder in which it is displayed. This value corresponds to the zero-based column number that is displayed in a Shell view. For an item in the file system, this can be one of the following values:
0
Retrieves the name of the item.
1
Retrieves the size of the item.
2
Retrieves the type of the item.
3
Retrieves the date and time that the item was last modified.
4
Retrieves the attributes of the item.
-1
Retrieves the info tip information for the item.

Return Value

String containing the retrieved detail.

Remarks

Note  Not all methods are implemented for all folders. For example, the ParseName method is not implemented for the Control Panel folder (CSIDL_CONTROLS). If you attempt to call an unimplemented method, a 0x800A01BD (decimal 445) error is raised.

Examples

The following example uses GetDetailsOf to retrieve the type of the file named Clock.avi. Proper usage is shown for Microsoft JScript, Microsoft Visual Basic Scripting Edition (VBScript), and Visual Basic.

JScript:

<script language="JScript">
    function fnGetDetailsOfJ()
    {
        var objShell = new ActiveXObject("Shell.Application");
        var objFolder = new Object;
        
        objFolder = objShell.NameSpace("C:\\WINDOWS");
        if (objFolder != null)
        {
            var objFolderItem = new Object;

            objFolderItem = objFolder.ParseName("clock.avi");
            if (objFolderItem != null)
            {
                var objInfo = new Object;

                objInfo = objFolder.GetDetailsOf(objFolderItem, 2);
            }
        }
    }
</script>

VBScript:

<script language="VBScript">
    function fnGetDetailsOfVB()
        dim objShell
        dim objFolder
        
        set objShell = CreateObject("Shell.Application")
        set objFolder = objShell.NameSpace("C:\WINDOWS")

        if (not objFolder is nothing) then
            dim objFolderItem

            set objFolderItem = objFolder.ParseName("clock.avi")

            if (not objFolderItem Is Nothing) then
                dim objInfo
                        
                objInfo = objFolder.GetDetailsOf(objFolderItem, 2)
            end if
            
            set objFolderItem = nothing
        end if
        
        set objFolder = nothing
        set objShell = nothing
    end function
</script>

Visual Basic:

Private Sub btnGetDetailsOf_Click()
    Dim objShell  As Shell
    Dim objFolder As Folder

    Set objShell = New Shell
    Set objFolder = objShell.NameSpace("C:\WINDOWS")
    
    If (Not objFolder Is Nothing) Then
        Dim objFolderItem As FolderItem
        Set objFolderItem = objFolder.ParseName("clock.avi")
   
        If (Not objFolderItem Is Nothing) Then
            Dim szItem As String
            szItem = objFolder.GetDetailsOf(objFolderItem, 2)
        End If
        
        Set objFolderItem = Nothing
    End If
    
    Set objFolder = Nothing
    Set objShell = Nothing
End Sub2

Applies To

Folder
Tags :


Community Content

Thomas Lee
Shell.Application Sample in PowerShell
# shellapplication.ps1
# shell.application sample in PowerShell
# Thomas Lee - tfl@psp.co.uk
 
# create new shell application object
$sh = new-object -com shell.application
# Get folder, then look for a file. if it exists, get its type
$folder = $sh.namespace("C:\windows")
if ($folder) {
$folderitem = $folder.parsename("clock.avi")
if ($folderitem) {
$name = $folder.getdetailsof($folderitem,0)
$size = $folder.getdetailsof($folderitem,1)
$type = $folder.getdetailsof($folderitem,2)
$date = $folder.getdetailsof($folderitem,3)
$attr = $folder.getdetailsof($folderitem,4)
$infotip = $folder.getdetailsof($folderitem,-1)
}
}
 
# Print results
If ($info) {
"The file c:\windows\clock.avi is:"
"{0,-20} {1}" -f "name", $NAME
"{0,-20} {1}" -f "size", $size
"{0,-20} {1}" -f "type", $type
"{0,-20} {1}" -f "date last modified", $date
"{0,-20} {1}" -f "atrributes", $attr
""
"Infotip:"
$infotip
}

#

This script produces the following output:

PS C:\foo> .\shellapplication.ps1
The file c:\windows\clock.avi is:
name clock.avi
size 81 KB
type Winamp media file
date last modified 04/08/2004 05:00
atrributes 11/08/2004 17:00
Infotip:
Type: Winamp media file
Duration: 00:00:12
Bit Rate: 8kbps
Dimensions: 321 x 321
Size: 81.0 KB


Page view tracker