未在o365日历中创建活动

时间:2019-05-15 21:24:46

标签: vb.net microsoft-graph

我正在尝试将事件添加到o365日历。仅在使用Fiddler监视流量时创建事件。关闭监视后,什么也没发生。

使用Fiddler检查流量时,请求发送成功。 使用调试器并逐步运行代码时,也会创建该事件。 运行该应用程序时,什么都不会发生。似乎await函数不是在等待完成。...

Public Shared Sub AppModeRequests()
callAddMyevent()
End Sub

        Public Shared Async Sub callAddMyevent()
            Dim blnresult As Boolean = Await AddMyEvent()
        End Sub

        Private Shared Async Function AddMyEvent() As Task(Of Boolean)
            Dim myEvent As New Microsoft.Graph.Event
            Dim myLocation As New Microsoft.Graph.Location
            Dim myItemBody As New Microsoft.Graph.ItemBody
            Dim myStartTime As New DateTimeTimeZone
            Dim myStopTime As New DateTimeTimeZone

            myLocation.DisplayName = "Testlocation"
            myStartTime.DateTime = "2019-05-14T12:00:00"
            myStartTime.TimeZone = "Europe/Paris"
            myStopTime.DateTime = "2019-05-14T13:00:00"
            myStopTime.TimeZone = "Europe/Paris"
            myItemBody.ContentType = BodyType.Text
            myItemBody.Content = "bodycontent"
            With myEvent
                .Subject = "testsubject"
                .Location = myLocation
                .Start = myStartTime
                .End = myStopTime
                .Body = myItemBody
            End With

            Dim createdevent As [Event] = Await client.Users("yves.gijbels@gaits.be").Calendars(Constants.CalendarClaudia).Events.Request().AddAsync(myEvent)

            If createdevent IsNot Nothing Then
                Return True
            Else
                Return False
            End If

        End Function

不生成任何错误消息。 怎么了?

0 个答案:

没有答案