在 C# 中将 Outlook 任务项标记为已完成
我正在创建状态标记为“已完成”的 Outlook 任务
if (task != null)
{
task.Subject = mi.Subject;
task.Status = (Outlook.OlTaskStatus)2; //Status remains 0
task.StartDate = DateTime.Now;
task.Save();
}
Outlook.OlTaskStatus
是一个 enum
,“完成”状态的值为 2。但它仍然为 0,并且任务未标记为完全的。我尝试过的将任务标记为已完成的方法如下:
task.Status = Outlook.OlTaskStatus.olTaskComplete;
task.MarkComplete();
task.Complete=true;
task.Status = (Outlook.OlTaskStatus)2;
似乎没有任何效果,并且 Status
仍然存在<代码>0。有人可以建议将 Outlook 任务标记为完成
的正确方法吗?
I'm creating an Outlook Task with status marked as Completed
if (task != null)
{
task.Subject = mi.Subject;
task.Status = (Outlook.OlTaskStatus)2; //Status remains 0
task.StartDate = DateTime.Now;
task.Save();
}
Outlook.OlTaskStatus
is an enum
and value of Complete state is 2. But it remains 0 and task is not marked as completed. Number of ways i've tried till to mark task as completed are as following:
task.Status = Outlook.OlTaskStatus.olTaskComplete;
task.MarkComplete();
task.Complete=true;
task.Status = (Outlook.OlTaskStatus)2;
Nothing appears to be effective and Status
is still 0
. Can someone please suggest the right way to mark an outlook task Complete
?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
TaskItem.MarkComplete 方法标记任务为已完成,并将
PercentComplete
设置为“100%”,将Complete
设置为 true,并将DateCompleted
设置为当前日期。我认为您需要更改属性和方法的调用顺序:
The TaskItem.MarkComplete method marks the task as completed and sets
PercentComplete
to "100%",Complete
to true, andDateCompleted
to the current date.I think you need to change the order in which properties and methods are called: