Error message dialog using cloud api

Jojo Tang 唐仕珊 41 Reputation points
2022-07-26T02:15:10.847+00:00

I use windows cloud api to implement file sync
When i double click unpinned file, it will trigger fetch callback to call CfExecute with type "CF_OPERATION_TYPE_TRANSFER_DATA"

If transfer file meet error, I set error code in TransferData.CompletionStatus = NTSTATUS_FROM_WIN32(Win32ErrorCode) in structure CF_OPERATION_PARAMETERS

but the error message dialog cannot show corresponding error code/message

for example, TransferData.CompletionStatus = NTSTATUS_FROM_WIN32(ERROR_SHARING_VIOLATION), error message shows 80070185
224733-errordialog.png

how to set error code that can show error message correct??

Windows development Windows API - Win32
0 comments No comments
{count} votes

Accepted answer
  1. Jeanine Zhang-MSFT 11,356 Reputation points Microsoft External Staff
    2022-07-26T08:25:11.633+00:00

    Hi,

    Welcome to Microsoft Q&A!

    According to the Doc: CF_OPERATION_PARAMETERS structure

    DUMMYUNIONNAME.TransferData.CompletionStatus

    Status for transferring data. Set to STATUS_SUCCESS if the sync provider will transfer data to a placeholder.

    Any status code returned outside of STATUS_CLOUD_FILE_ range except for STATUS_SUCCESS will be converted to STATUS_CLOUD_FILE_UNSUCCESSFUL by the platform.

    I suggest you could try to use the STATUS_CLOUD_FILE_ACCESS_DENIED instead of STATUS_ACCESS_DENIED.

    For more details I suggest you could refer to the similar thread: https://learn.microsoft.com/en-us/answers/questions/280676/change-error-message-when-canceling-delete-operati.html

    Best Regards,

    Jeanine


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    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.

    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Jojo Tang 唐仕珊 41 Reputation points
    2022-07-28T06:20:20.667+00:00

    It's working.
    Thanks for your help.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.