Dim clientTZService As ExchangeService = New ExchangeService(ExchangeVersion.Exchange2010)
clientTZService.Credentials = New NetworkCredential(userEmail, userPass)
clientTZService.AutodiscoverUrl(userEmail, AddressOf RedirectionCallBack)
Dim Task1 As Task = New Task(clientTZService)
Task1.Subject = "New Task"
Task1.Body = New MessageBody(String.Format("test"))
Task1.StartDate = DateTime.Now
Dim DueDate As DateTime = New DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day + 2)
Task1.DueDate = DueDate
Task1.Recurrence = New Recurrence.MonthlyPattern(New DateTime(2017, 4, 11, 10, 0, 0), 1, 11)
Task1.Recurrence.StartDate = New DateTime(2017, 4, 11, 10, 0, 0)
Task1.Save(New FolderId(WellKnownFolderName.Tasks, "test@domain.com"))
任何人都可以告诉我使用EWS使用EWS更新任务的最简单方法: 谢谢。
答案 0 :(得分:1)
您用于创建任务的任务类具有Update方法https://msdn.microsoft.com/EN-US/library/microsoft.exchange.webservices.data.task.update(v=exchg.80).aspx,您可以使用它来更新任务。与EWS中的任何其他邮箱项目一样,在您可以更新它之前,您需要使用FindItems https://msdn.microsoft.com/en-us/library/office/dd633693(v=exchg.80).aspx来查找要更新的对象的EWSId,然后更改要更改的属性并调用Update方法。
答案 1 :(得分:0)
请参阅以下内容:
Dim instance As ConflictResolutionMode = ConflictResolutionMode.AlwaysOverwrite
Dim tasksFolder As Folder = Folder.Bind(clientTZService, New FolderId(WellKnownFolderName.Tasks, useremail))
tasksFolder.Load()
For Each task1 As Task In tasksFolder.FindItems(New ItemView(100))
task1.Load()
If task1.Id.ToString = taskrow("OutlookTaskID") Then
task1.PercentComplete = 100
task1.Update(instance)
Exit For
End If
Next