This topic has not yet been rated - Rate this topic

IShellFolder::GetAttributesOf method

Applies to: desktop apps only

Gets the attributes of one or more file or folder objects contained in the object represented by IShellFolder.

Syntax

HRESULT GetAttributesOf(
  [in]       UINT cidl,
  [in]       PCUITEMID_CHILD_ARRAY *apidl,
  [in, out]  SFGAOF *rgfInOut
);

Parameters

cidl [in]

Type: UINT

The number of items from which to retrieve attributes.

apidl [in]

Type: PCUITEMID_CHILD_ARRAY*

The address of an array of pointers to ITEMIDLIST structures, each of which uniquely identifies an item relative to the parent folder. Each ITEMIDLIST structure must contain exactly one SHITEMID structure followed by a terminating zero.

rgfInOut [in, out]

Type: SFGAOF*

Pointer to a single ULONG value that, on entry, contains the bitwise SFGAO attributes that the calling application is requesting. On exit, this value contains the requested attributes that are common to all of the specified items.

Return value

Type: HRESULT

If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.

Remarks

To optimize this operation, do not return unspecified flags.

For a folder object, the SFGAO_BROWSABLE attribute implies that the client can bind to this object as shown in a general form here.


IShellFolder::BindToObject(..., pidl, IID_IShellFolder, &psfItem);


The client can then create an IShellView on that item through this statement.


psfItem->CreateViewObject(..., IID_IShellView,...);


The SFGAO_DROPTARGET attribute implies that the client can bind to an instance of IDropTarget for this folder by calling IShellFolder::GetUIObjectOf as shown here.


IShellFolder::GetUIObjectOf(hwnd, 1, &pidl, IID_IDropTarget, NULL, &pv)


The SFGAO_NONENUMERATED attribute indicates an item that is not returned by the enumerator created by the IShellFolder::EnumObjects method.

Requirements

Minimum supported client

Windows XP

Minimum supported server

Windows 2000 Server

Header

Shobjidl.h

IDL

Shobjidl.idl

DLL

Shell32.dll (version 4.0 or later)

See also

IShellFolder

 

 

Send comments about this topic to Microsoft

Build date: 3/7/2012

Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ
Contrary to the documentation implying that this method only returns S_OK for success
I see S_FALSE is returned when dealing with the folders immediately beneath the generic "Documents", "Pictures", Videos", etc. Library groups. Specifically, folders such as "My Documents", "Public Documents", "My Pictures", "Public Pictures", etc.) under the Windows 7 Libraries sub-groups all return S_FALSE, rather than S_OK. However, the same folders when referenced outside of the Libraries feature return the normal S_OK. The upshot is that if you're checking the return value, you should probably test for SUCCEEDED( hResult) rather than S_OK.
SFGAO Enum for Constant Values


Imports System.ComponentModel



''' <summary>
''' <b>SFGAO</b> - Attributes that can be retrieved on an item (file or folder) or set of items.
''' </summary>
''' <remarks>
''' http://msdn.microsoft.com/en-us/library/bb762589(VS.85).aspx
''' </remarks>
<Flags()> _
Public Enum FileFlags As UInt32 'ASAP:MSDN
SFGAO_BROWSABLE = &H8000000UI
SFGAO_CANCOPY = &H1
SFGAO_CANDELETE = &H20UI
SFGAO_CANLINK = &H4
SFGAO_CANMONIKER = &H400000UI
SFGAO_CANMOVE = &H2
SFGAO_CANRENAME = &H10UI
<EditorBrowsable(EditorBrowsableState.Never)> SFGAO_CAPABILITYMASK = &H177UI
SFGAO_COMPRESSED = &H4000000UI
<EditorBrowsable(EditorBrowsableState.Never)> SFGAO_CONTENTSMASK = &H80000000UI
<EditorBrowsable(EditorBrowsableState.Never)> SFGAO_DISPLAYATTRMASK = &HF0000UI
SFGAO_DROPTARGET = &H100UI
SFGAO_ENCRYPTED = &H2000UI
SFGAO_FILESYSANCESTOR = &H10000000UI
SFGAO_FILESYSTEM = &H40000000UI
SFGAO_FOLDER = &H20000000UI
SFGAO_GHOSTED = &H80000UI
SFGAO_HASPROPSHEET = &H40UI
<EditorBrowsable(EditorBrowsableState.Never)> SFGAO_HASSTORAGE = &H400000UI
SFGAO_HASSUBFOLDER = &H80000000UI
SFGAO_HIDDEN = &H80000UI
SFGAO_ISSLOW = &H4000UI
SFGAO_LINK = &H10000UI
SFGAO_NEWCONTENT = &H200000UI
SFGAO_NONENUMERATED = &H100000UI
SFGAO_PKEYSFGAOMASK = &H81044000UI
SFGAO_READONLY = &H40000UI
SFGAO_REMOVABLE = &H2000000UI
SFGAO_SHARE = &H20000UI
SFGAO_STORAGEANCESTOR = &H10000000UI
SFGAO_STORAGECAPMASK = &H70C50008UI
SFGAO_STREAM = &H400000UI
SFGAO_VALIDATE = &H1000000UI
End Enum