我一直在尝试创建一些代码来在EWS中生成非重复性任务。我已经遵循了这个link,遗憾的是,没有提供实际发送任务的代码。然后我按照每个人似乎都参考的这个Office Dev Center link。
但是,无法识别 CreateItemType()。
到目前为止,这是我的代码:
{1,5,9,3,7}
我已经通过Nuget和
安装了Microsoft Exchange WebServices 2.2.0const string o365Server = "myO365Domain";
const string targetMailId = "myemail@test.com";
var service = new ExchangeService();
var task = new Task(service);
string itemId = null;
task.Subject = "mySubject";
task.Body = new MessageBody {BodyType = BodyType.Text, Text = "my new task"};
task.StartDate = DateTime.Now;
var createItemRequest = new CreateItemType();
createItemRequest.Items = new NonEmptyArrayOfAllItemsType();
createItemRequest.Items.Items = new ItemType[1];
createItemRequest.Items.Items[0] = task;
我只是希望能够将任务发送到我们O365域中的各个电子邮件帐户。任何帮助将不胜感激。
答案 0 :(得分:0)
Dim clientTZService As ExchangeService = New ExchangeService(ExchangeVersion.Exchange2010)
clientTZService.Credentials = New NetworkCredential(userEmail, userPass)
clientTZService.AutodiscoverUrl(userEmail, AddressOf RedirectionCallBack)
' Create the task
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.Save(New FolderId(WellKnownFolderName.Tasks, "test@domain.com"))