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;
}