IFileOperationProgressSink::PostNewItem method (shobjidl_core.h)

Performs caller-implemented actions after the new item is created.


HRESULT PostNewItem(
  [in] DWORD      dwFlags,
  [in] IShellItem *psiDestinationFolder,
  [in] LPCWSTR    pszNewName,
  [in] LPCWSTR    pszTemplateName,
  [in] DWORD      dwFileAttributes,
  [in] HRESULT    hrNew,
  [in] IShellItem *psiNewItem


[in] dwFlags


bitwise value that contains flags that were used during the creation operation. Some values can be set or changed during the creation operation. See TRANSFER_SOURCE_FLAGS for flag descriptions.

[in] psiDestinationFolder

Type: IShellItem*

Pointer to an IShellItem that specifies the destination folder to which the new item was added.

[in] pszNewName


Pointer to the file name of the new item, for instance Newfile.txt. This is a null-terminated, Unicode string.

[in] pszTemplateName


Pointer to the name of the template file (for example Excel9.xls) that the new item is based on, stored in one of the following locations:

  • CSIDL_COMMON_TEMPLATES. The default path for this folder is %ALLUSERSPROFILE%\Templates.
  • CSIDL_TEMPLATES. The default path for this folder is %USERPROFILE%\Templates.
  • %SystemRoot%\shellnew
This is a null-terminated, Unicode string used to specify an existing file of the same type as the new file, containing the minimal content that an application wants to include in any new file.

This parameter is normally NULL to specify a new, blank file.

[in] dwFileAttributes


The file attributes applied to the new item. One or more of the values found at GetFileAttributes.

[in] hrNew


The return value of the creation operation. Note that this is not the HRESULT returned by NewItem, which simply queues the creation operation. Instead, this is the result of the actual creation.

[in] psiNewItem

Type: IShellItem*

Pointer to an IShellItem that represents the new item.

Return value


Returns S_OK if successful, or an error value otherwise. In the case of an error value, all subsequent operations pending from the call to IFileOperation are canceled.


Requirement Value
Minimum supported client Windows Vista [desktop apps only]
Minimum supported server Windows Server 2008 [desktop apps only]
Target Platform Windows
Header shobjidl_core.h (include Shobjidl.h)