Skip to content

Latest commit

 

History

History
113 lines (88 loc) · 3.45 KB

nf-syncmgr-isyncmgrsynccallback-additemtosession.md

File metadata and controls

113 lines (88 loc) · 3.45 KB
UID title description helpviewer_keywords old-location tech.root ms.assetid ms.date ms.keywords req.header req.include-header req.target-type req.target-min-winverclnt req.target-min-winversvr req.kmdf-ver req.umdf-ver req.ddi-compliance req.unicode-ansi req.idl req.max-support req.namespace req.assembly req.type-library req.lib req.dll req.irql targetos req.typenames req.redist ms.custom f1_keywords dev_langs topic_type api_type api_location api_name
NF:syncmgr.ISyncMgrSyncCallback.AddItemToSession
ISyncMgrSyncCallback::AddItemToSession (syncmgr.h)
Adds a specified item to the set of items currently being synchronized.
AddItemToSession
AddItemToSession method [Windows Shell]
AddItemToSession method [Windows Shell]
ISyncMgrSyncCallback interface
ISyncMgrSyncCallback interface [Windows Shell]
AddItemToSession method
ISyncMgrSyncCallback.AddItemToSession
ISyncMgrSyncCallback::AddItemToSession
_shell_ISyncMgrSyncCallback_AddItemToSession
shell.ISyncMgrSyncCallback_AddItemToSession
syncmgr/ISyncMgrSyncCallback::AddItemToSession
shell\ISyncMgrSyncCallback_AddItemToSession.htm
shell
1de3d6c0-cdf8-48fa-b7ff-2dc75f6757fc
12/05/2018
AddItemToSession, AddItemToSession method [Windows Shell], AddItemToSession method [Windows Shell],ISyncMgrSyncCallback interface, ISyncMgrSyncCallback interface [Windows Shell],AddItemToSession method, ISyncMgrSyncCallback.AddItemToSession, ISyncMgrSyncCallback::AddItemToSession, _shell_ISyncMgrSyncCallback_AddItemToSession, shell.ISyncMgrSyncCallback_AddItemToSession, syncmgr/ISyncMgrSyncCallback::AddItemToSession
syncmgr.h
Windows
Windows Vista [desktop apps only]
Windows Server 2008 [desktop apps only]
Syncmgr.idl
Windows
19H1
ISyncMgrSyncCallback::AddItemToSession
syncmgr/ISyncMgrSyncCallback::AddItemToSession
c++
APIRef
kbSyntax
COM
Syncmgr.h
ISyncMgrSyncCallback.AddItemToSession

ISyncMgrSyncCallback::AddItemToSession

-description

Adds a specified item to the set of items currently being synchronized.

-parameters

-param pszItemID [in]

Type: LPCWSTR

A pointer to a buffer containing the unique ID of the item to add. This string is of maximum length MAX_SYNCMGR_ID including the terminating null character.

-returns

Type: HRESULT

Returns S_OK if successful, or an error value otherwise. Returns E_INVALIDARG if pszItemID is already part of the session.

-remarks

ISyncMgrSyncCallback::AddItemToSession is called by the sync handler.

Examples

The following example shows the usage of ISyncMgrSyncCallback::AddItemToSession by the Synchronize method.

HRESULT CMyDeviceHandler::Synchronize(...)
{
    ...

    // Start synchronizing the handler.

    ...

    // Check for additional items to sync.
    IEnumString *penumItemIDs = NULL;
    
    hr = pCallback->QueryForAdditionalItems(&penumItemIDs);
    if (hr == S_OK)
    {
        while (hr == S_OK)
        {
            LPWSTR pszItemID;
            ULONG cFetched;
            hr = penumItemIDs->Next(1, &pszItemID, &cFetched);
            if ((hr == S_OK) && (cFetched == 1))
            {
                // Add this item to the set of items we are syncing.
                hr = pCallback->AddItemToSession(pszItemID);
                CoTaskMemFree(pszItemID);
            }
        }
        penumItemIDs->Release();
    }
    ...
}