Export (0) Print
Expand All

IShellLibrary::AddFolder method

Adds a folder to the library.

Syntax


HRESULT AddFolder(
  [in]  IShellItem *psiLocation
);

Parameters

psiLocation [in]

Type: IShellItem*

An IShellItem object that represents the folder to be added to the library.

Return value

Type: HRESULT

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

Remarks

When a folder is added to a library it is also added to the Windows Search index.

For convenience, SHAddFolderPathToLibrary can be used in place of this method.

Examples

The following code example shows the helper function SHAddFolderPathToLibrary, which wraps this method.


//
// From Shobjidl.h
//
__inline HRESULT SHAddFolderPathToLibrary (
    __in IShellLibrary *plib,
    __in PCWSTR pszFolderPath
)
{
    IShellItem *psiFolder;
    
    HRESULT hr = SHCreateItemFromParsingName (
      pszFolderPath, 
      NULL,
      IID_PPV_ARGS(&psiFolder));
    
    if (SUCCEEDED(hr))
    {
        hr = plib->AddFolder (psiFolder);
        psiFolder->Release ();
    }
    return hr;
}

Requirements

Minimum supported client

Windows 7 [desktop apps only]

Minimum supported server

Windows Server 2008 R2 [desktop apps only]

Header

Shobjidl.h

IDL

Shobjidl.idl

See also

Windows Libraries
Library Description Schema
IShellLibrary
SHAddFolderPathToLibrary
SHRemoveFolderPathFromLibrary
IShellLibrary::RemoveFolder
SHLoadLibraryFromItem
SHLoadLibraryFromKnownFolder
SHLoadLibraryFromParsingName
IShellLibrary::LoadLibraryFromItem
IShellLibrary::LoadLibraryFromKnownFolder

 

 

Community Additions

ADD
Show:
© 2014 Microsoft