I'm developing Windows Form app using Graph API. I have Excel file
with data from Teams. Excel columns are: Display name, Feedback, Points,Submission id, OutcomeFeedback id and OutcomePoints id. I want to
update the value of points in the Excel file and write that value on
Teams. The problem is that when I leave the field for points empty, I
get an error. Does anyone know how to solve this? Here is the code:
- for (int i = 2; i <= rowCount; i++)
- {
- string cellValue1 = Convert.ToString(excelWorksheet.Cells[i, 2].Value);
- string cellValue2 = Convert.ToString(excelWorksheet.Cells[i, 3].Value);
- string cellValue3 = Convert.ToString(excelWorksheet.Cells[i, 4].Value);
- string cellValue4 = Convert.ToString(excelWorksheet.Cells[i, 5].Value);
- string cellValue5 = Convert.ToString(excelWorksheet.Cells[i, 6].Value);
-
- if(cellValue1 == null)
- {
- await GraphHelper.UpdateFeedback("", this.team_id, assignment_id, cellValue3, cellValue4);
- }
- else
- {
- await GraphHelper.UpdateFeedback(cellValue1, this.team_id, assignment_id, cellValue3, cellValue4);
- }
-
- if(cellValue2 == null)
- {
- await GraphHelper.UpdatePoints("", this.team_id, assignment_id, cellValue3, cellValue5);
- }
- else if(Int32.Parse(cellValue2) <= 100 && Int32.Parse(cellValue2) >= 0)
- {
- await GraphHelper.UpdatePoints(cellValue2, this.team_id, assignment_id, cellValue3, cellValue5);
- }
- }
-
- public static async Task UpdatePoints(string points, string teamId, string assignmentId, string submissionId, string outcomeId)
- {
- graphClient = GetGraphClient(token);
-
- var educationOutcomePoint = new EducationPointsOutcome
- {
- Points = new EducationAssignmentPointsGrade
- {
- Points = Int32.Parse(points)
- }
- };
-
- await GraphHelper.graphClient.Education.Classes[teamId].Assignments[assignmentId].Submissions[submissionId].Outcomes[outcomeId]
- .Request()
- .UpdateAsync(educationOutcomePoint);
- }