Microsoft graph api 如何为团队中的分数编写空值?

Microsoft graph api 如何为团队中的分数编写空值?,microsoft-graph-api,microsoft-teams,Microsoft Graph Api,Microsoft Teams,我正在使用图形API开发Windows窗体应用程序。我有一个Excel文件,里面有来自团队的数据。Excel列包括:显示名称、反馈、点数、提交id、结果反馈id和结果点数id。我想更新Excel文件中点数的值,并将该值写入团队。问题是,当我将points字段留空时,会出现一个错误。有人知道如何解决这个问题吗?代码如下: for (int i = 2; i <= rowCount; i++) {

我正在使用图形API开发Windows窗体应用程序。我有一个Excel文件,里面有来自团队的数据。Excel列包括:显示名称、反馈、点数、提交id、结果反馈id和结果点数id。我想更新Excel文件中点数的值,并将该值写入团队。问题是,当我将points字段留空时,会出现一个错误。有人知道如何解决这个问题吗?代码如下:

 for (int i = 2; i <= rowCount; i++)
                        {
                            string cellValue1 = Convert.ToString(excelWorksheet.Cells[i, 2].Value); //feedback
                            string cellValue2 = Convert.ToString(excelWorksheet.Cells[i, 3].Value); //points
                            string cellValue3 = Convert.ToString(excelWorksheet.Cells[i, 4].Value); //submission id
                            string cellValue4 = Convert.ToString(excelWorksheet.Cells[i, 5].Value); //outcome feedback id
                            string cellValue5 = Convert.ToString(excelWorksheet.Cells[i, 6].Value); //outcome points 

                            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);
    }

for(int i=2;i如果可能,您可以使用0代替空字符串。当您尝试解析空字符串
Int32.parse(points)
时,可能会引发异常

。。。
如果(cellValue1==null)
{
等待GraphHelper.UpdateFeedback(“0”,this.team\u id,assignment\u id,cellValue3,cellValue4);
}
其他的
{
等待GraphHelper.UpdateFeedback(cellValue1,this.team_id,assignment_id,cellValue3,cellValue4);
}
如果(cellValue2==null)
{
等待GraphHelper.UpdatePoints(“0”,this.team_id,assignment_id,cellValue3,cellValue5);
}
else if(Int32.Parse(cellValue2)=0)
{
等待GraphHelper.UpdatePoints(cellValue2,this.team_id,assignment_id,cellValue3,cellValue5);
}
...
...
if(cellValue1 == null)
{
    await GraphHelper.UpdateFeedback("0", 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("0", 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);
}
...