IShellFolderView::AddObject method

[AddObject is available for use in the operating systems specified in the Requirements section. It may be altered or unavailable in subsequent versions.]

Adds an item to the view.


HRESULT AddObject(
  [in]  PUITEMID_CHILD pidl,
  [out] UINT           *puItem


pidl [in]


A pointer to an ItemID that specifies the item to add to the view.

puItem [out]

Type: UINT*

A pointer to a value that, when this method returns successfully, receives the index position of the added item.

Return value


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


If you immediately call IShellFolderView::GetObject with this index, you will get a copy of the ITEMID_CHILD that you added. However, the index position of an item may change over time, so code cannot trust that any specific index always returns the same ITEMID_CHILD.

Items added through this method can be removed from the view by the data source at any time.


Minimum supported client

Windows XP [desktop apps only]

Minimum supported server

Windows Server 2003 [desktop apps only]

End of client support

Windows Vista

End of server support

Windows Server 2008