Hi @Pierre Velluet
Per my test, I access sharepoint document by following code without 403 error
var uri = $"https://xxx.sharepoint.com/:w:/s/xiexin/EQVkdVfmxC5Fgthsy0WWMYEBrDoTDPOg09mf_geU9NOpWQ?e=mmcwaE";
var handler = new HttpClientHandler { AllowAutoRedirect = false, UseCookies = true };
while (true)
{
var request = new HttpRequestMessage(HttpMethod.Post, uri);
var response = new HttpClient(handler).SendAsync(request).ConfigureAwait(false).GetAwaiter().GetResult();
var statusCode = (int)response.StatusCode;
if (statusCode >= 300 && statusCode <= 399)
{
var redirectUri = response.Headers.Location;
if (!redirectUri.IsAbsoluteUri)
{
redirectUri = new Uri(request.RequestUri.GetLeftPart(UriPartial.Authority) + redirectUri);
}
uri = redirectUri.AbsoluteUri;
continue;
}
if (response.IsSuccessStatusCode)
{
var data = response.Content.ReadAsStreamAsync().GetAwaiter().GetResult();
}
}
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.