.NET
Microsoft Technologies based on the .NET software framework.
3,649 questions
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Hi,
I've inherited a system which has sporadic errors when accessing an Excel spreadsheet on business onedrive via v4 Graph API. I am using the .NET SDK (v4.54.0). The code that often provokes the situation looks like this:
await GetDocuplanWorkbook(folderPath, fileName)
.Worksheets[sheet.Name]
.Range($"{worksheetData.GetExcelLocation(rowNumber, 1)}:{worksheetData.GetExcelLocation(rowNumber, row.Length)}")
.Request()
.WithRetries(_logger)
.PatchAsync(new WorkbookRange
{
Values = JsonDocument.Parse(JsonSerializer.Serialize(new[] { row })),
NumberFormat = JsonDocument.Parse(JsonSerializer.Serialize(new[] { worksheetData.GetColumnsExcelFormat(sheet.ExcelFormatMappings) }))
});
When an error occurs (during the day time this is 10-20% of user operations) I get a 405 MethodNotAllowed but no JSON error payload. Instead I get an HTML document returned:
<div><h1>Server Error</h1></div>
<div>
<div><fieldset>
<h2>405 - HTTP verb used to access this page is not allowed.</h2>
<h3>The page you are looking for cannot be displayed because an invalid method (HTTP verb) was used to attempt access.</h3>`
</fieldset></div>
</div>
The issue always seems to be when using the Range endpoint, e.g.
https://graph.microsoft.com:443/v1.0/users/