Error State Icon on Placeholder

cgrom 26 Reputation points
2021-03-12T09:03:46.133+00:00

Hi,
we are developping a sync engine using Cloud Filter API.
If we place a file in a synced folder, the upload to the server might fail on any reason.
We would like to set the file state to an error icon instead of the Pending or In Sync state icon.

Any help would be appreciated.

HRESULT SyncFolder::ConvertToPlaceholder(LPWSTR path)
{
    FileIdentity identity;
    HANDLE opLock;
    auto cfOpenFileFlags = CF_OPEN_FILE_FLAGS::CF_OPEN_FILE_FLAG_EXCLUSIVE;

    auto hr = CfOpenFileWithOplock(path, cfOpenFileFlags, &opLock);

    USN usn = {};
    if (hr != S_OK)
    {
        return hr;
    }

    HRESULT hrUpload = Upload(opLock, &identity);
    if ((hrUpload == S_OK)
    {
        hr = CfConvertToPlaceholder(opLock, &identity, sizeof(FileIdentity), 
                    CF_CONVERT_FLAGS::CF_CONVERT_FLAG_MARK_IN_SYNC, &usn, nullptr);
    }
    else
    {
        // Convert to Placeholder with error state
    }
    CfCloseHandle(opLock);
    return hr;
}
Windows API - Win32
Windows API - Win32
A core set of Windows application programming interfaces (APIs) for desktop and server applications. Previously known as Win32 API.
2,519 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Strive Sun-MSFT 426 Reputation points
    2021-03-15T07:37:49.057+00:00

    Hello, @cgrom

    Please check if this thread is useful.

    How to change a Cloud File placeholder's status icon?

    ----------

    Thank you!

    If the answer is helpful, please click "Accept Answer" and upvote it.

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.