ISyncMgrSyncCallback::ReportEvent method (syncmgr.h)
Provides an event to add to the Sync Results folder for an item being synchronized.
Syntax
HRESULT ReportEvent(
[in] LPCWSTR pszItemID,
[in] SYNCMGR_EVENT_LEVEL nLevel,
[in] SYNCMGR_EVENT_FLAGS nFlags,
[in] LPCWSTR pszName,
[in] LPCWSTR pszDescription,
[in] LPCWSTR pszLinkText,
[in] LPCWSTR pszLinkReference,
[in] LPCWSTR pszContext,
[out] GUID *pguidEventID
);
Parameters
[in] pszItemID
Type: LPCWSTR
A pointer to a buffer that contains the unique ID of the item currently being synchronized. This string is of maximum length MAX_SYNCMGR_ID including the terminating null character.
[in] nLevel
Type: SYNCMGR_EVENT_LEVEL
A value from the SYNCMGR_EVENT_LEVEL enumeration declaring the type of event involved.
[in] nFlags
Type: SYNCMGR_EVENT_FLAGS
Not used.
[in] pszName
Type: LPCWSTR
A pointer to a buffer that contains the name of the event.
[in] pszDescription
Type: LPCWSTR
A pointer to a buffer that contains a description of the event.
[in] pszLinkText
Type: LPCWSTR
A pointer to a buffer that contains the text to be used in a hyperlink to the item. This parameter can be NULL
[in] pszLinkReference
Type: LPCWSTR
A pointer to a buffer that contains the URL of the item. This parameter can be NULL
[in] pszContext
Type: LPCWSTR
Handler-specific data to associate with the event.
[out] pguidEventID
Type: GUID*
When this method returns, contains a pointer to a unique ID for the event.
Return value
Type: HRESULT
If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.
Remarks
For the handler to provide more details to the user about the sync result, the property sheet for individual sync results reported by the handler can be extended.
This method replaces LogError.
The event is stored only in memory, so all events are cleared when the user logs off or shuts down. This is one reason to implement a custom ISyncMgrEventStore, which can provide its events from anywhere, including a file, over the network, or the registry. The sync results folder, however, shows events provided both by the internal event store and by custom event stores provided by sync handlers.
Examples
The following example shows the usage of ISyncMgrSyncCallback::ReportProgress by the Synchronize method.
STDMETHODIMP CMyDeviceHandler::Synchronize(...)
{
...
// Get the event receiver interface.
ISyncMgrEventReceiver *pEventReceiver = NULL;
hr = pCallback->QueryInterface(IID_ISyncMgrEventReceiver,
(void **) &pEventReceiver);
...
// Start synchronizing the sync item.
...
// Generate a GUID for this item.
// Construct a string to display in the Sync Results folder.
// Store the information about this event so we can display more details.
// Report the event to Sync Center.
hr = pEventReceiver->ReportEvent(pszItemID,
SYNCMGR_EL_INFORMATION,
SYNCMGR_EF_NONE,
pszEventName,
pszEventDescription,
NULL,
NULL,
NULL,
&guidEventID);
...
}
Requirements
Requirement | Value |
---|---|
Minimum supported client | Windows Vista [desktop apps only] |
Minimum supported server | Windows Server 2008 [desktop apps only] |
Target Platform | Windows |
Header | syncmgr.h |