给出此StackOverflow问题中Can I add multiple events to a calendar?给出的批处理响应>
尚不清楚如何使用C#SDK并将参数传递到请求中。我看到的示例都是关于通过批处理检索数据的,但是我看不到一种清晰的方法来传递参数。
我之前的代码(补丁发布之前),我只会在Request()方法上调用AddAsync或UpdateAsync。但是对于批处理,我不能拥有那些“添加/更新”方法。这就是我的代码:
await _graphClient.Me.Calendars[_calendarID].Events .Request() .AddAsync(@event);
但是我不清楚为什么将更新的事件对象添加到日历中。如何正确传递参数?
var batch = new BatchRequestContent(); // The response given is a GET METHOD var request = _graphClient.Me.Calendars[_calendarID].Events .Request() .GetHttpRequestMessage(); // UPDATE the request to POST along with data in content // (Am I wrong here in doing it this way?) request.Method = HttpMethod.Post; request.Content = new StringContent(JsonConvert.SerializeObject(@event)); batch.AddBatchRequestStep(request); var response = await _graphClient.Batch.Request().PostAsync(batch);
上面的代码也不喜欢在request.Content属性中提供的JSON。请让我知道向请求提供数据的正确方法是什么,以及如果我写帖子完全错误。谢谢!
给出了我可以在日历中添加多个事件的StackOverflow问题中对批处理的响应吗?目前尚不清楚如何使用C#SDK将参数传递到请求中。 ...