public static async Task <bool> TryAbsExcelFunctionAsync() { string createdFileId = await UserSnippets.UploadExcelFileAsync("excelTestResource.xlsx"); WorkbookFunctionResult excelWorkbookFunctionResult = await UserSnippets.AbsExcelFunctionAsync(createdFileId); return(excelWorkbookFunctionResult != null); }
public static async Task <WorkbookFunctionResult> AbsExcelFunctionAsync(string fileId) { WorkbookFunctionResult workbookFunctionResult = null; try { GraphServiceClient graphClient = AuthenticationHelper.GetAuthenticatedClient(); // Get the absolute value of -10 JToken inputNumber = JToken.Parse("-10"); workbookFunctionResult = await graphClient.Me.Drive.Items[fileId].Workbook.Functions.Abs(inputNumber).Request().PostAsync(); Debug.WriteLine("Ran the Excel ABS function: " + workbookFunctionResult.Value); } catch (Microsoft.Graph.ServiceException e) { Debug.WriteLine("We failed to run the ABS function: " + e.Error.Message); } return(workbookFunctionResult); }