Transient 405 errors when accessing Worksheets via Graph API v4

Andy Schneider 20 Reputation points


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)
                            .Range($"{worksheetData.GetExcelLocation(rowNumber, 1)}:{worksheetData.GetExcelLocation(rowNumber, row.Length)}")
                            .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>
  <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>`

The issue always seems to be when using the Range endpoint, e.g.
Microsoft Technologies based on the .NET software framework.
3,548 questions
Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
11,146 questions
Office Development
Office Development
Office: A suite of Microsoft productivity software that supports common business tasks, including word processing, email, presentations, and data management and analysis.Development: The process of researching, productizing, and refining new or existing technologies.
3,663 questions
0 comments No comments
{count} votes