Upload file to OneDrive faliled with generalException

FCT 1 Reputation point

We found if we upload corrupted docx files to SharePoint via direct api, we would got generalException error.

As MS support mentioned, it may caused by the security scan and be detected there might be some risks in the files.

Is there anyone know how we can judge if the error is due to the file itself or just an unknown error when we get the generalException error . It would be important if we want to handle these cases in a different way.

Thanks for reading.

BTW, if we upload the file via SharePoint UI, we could get a more meaningful error message "CobaltAllZerosDetected".

SharePoint Development
SharePoint Development
SharePoint: A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.Development: The process of researching, productizing, and refining new or existing technologies.
2,754 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Tong Zhang_MSFT 9,136 Reputation points

    Hi @FCT ,

    According to my research and testing, to help you better, please try to do some troubleshooting:

    1. Upload a file without corruption, and see if there is the same error.
    2. Check if the issue only occurs in this SharePoint site.

    Also, what version of SharePoint are you using? SharePoint online or SharePoint 2019/2016/2013?

    If the answer is helpful, 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.