The remote server returned an error: (400) Bad Request - Sharepoint

Braian Anderson 20 Reputation points
2024-08-29T02:07:15.9633333+00:00

Hi, I keep encountering the following error every time I try to log in to SharePoint using C# code:

'The remote server returned an error: (400) Bad Request.'

I've already followed all the steps outlined here 'https://learn.microsoft.com/en-us/answers/questions/1921238/how-to-upload-a-file-to-sharepoint?page=1&orderby=Helpful&comment=answer-1713065#newest-answer-comment'

and here [https://learn.microsoft.com/en-us/answers/questions/1922586/did-not-get-a-response-from-the-login-server-(idcr?page=1&orderby=Helpful&comment=answer-1781065](https://learn.microsoft.com/en-us/answers/questions/1922586/did-not-get-a-response-from-the-login-server-(idcr?page=1&orderby=Helpful&comment=answer-1781065)

I've been trying to resolve this issue for over a week and am running out of options.

Any help would be greatly appreciated

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,943 questions
{count} votes

1 answer

Sort by: Most helpful
  1. RaytheonXie_MSFT 35,066 Reputation points Microsoft Vendor
    2024-08-30T02:28:02.4966667+00:00

    Hi @Braian Anderson,

    The issue here might was that VS created console application as a .net core app, which as far as I'm aware does not work with the Microsoft.SharePoint.Client library. Please check if you created Console App(.Net Framework)

    User's image


    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.


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.