使用Exchange Web服务(EWS)托管API为其他用户创建任务 [英] Creating Tasks for other users using Exchange Web Services (EWS) Managed API

查看:101
本文介绍了使用Exchange Web服务(EWS)托管API为其他用户创建任务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

作为 EWS托管API新手,我在查找有关创建和管理任务的示例和文档时遇到了一些问题。

As an "EWS Managed API Newbie", I'm having some problems finding examples and documentation about creating and managing Tasks.

我设法创建了一个自己完成任务。但是,我确实需要能够执行以下操作-如果有人可以给我任何指示,我将不胜感激...

I've managed to create a task for myself without a problem. However, I really need to be able to do the following - if anyone could give me any pointers I'd really appreciate it...


  1. 创建任务并将其分配给其他用户。

  2. 在将任务分配给该用户时,能够询问该任务的状态(完成百分比等)。

  3. 随时更新任务注释。

请提前感谢任何指针!

推荐答案

这篇文章为我工作

后代的粘贴代码:

public string CreateTaskItem(string targetMailId)
    {

        string itemId = null;

        task.Subject = "Amit: sample task created from SDE and EWS";

        task.Body = new BodyType();

        task.Body.BodyType1 = BodyTypeType.Text;

        task.Body.Value = "Amit created task for you!";

        task.StartDate = DateTime.Now;

        task.StartDateSpecified = true;



        // Create the request to make a new task item.

        CreateItemType createItemRequest = new CreateItemType();

        createItemRequest.Items = new NonEmptyArrayOfAllItemsType();

        createItemRequest.Items.Items = new ItemType[1];

        createItemRequest.Items.Items[0] = task;

        /** code from create appointment **/

        DistinguishedFolderIdType defTasksFolder = new DistinguishedFolderIdType();

        defTasksFolder.Id = DistinguishedFolderIdNameType.tasks;
        defTasksFolder.Mailbox = new EmailAddressType();

        defTasksFolder.Mailbox.EmailAddress = targetMailId;

        TargetFolderIdType target = new TargetFolderIdType();

        target.Item = defTasksFolder;



        createItemRequest.SavedItemFolderId = target;


        try

        {

            // Send the request and get the response.

            CreateItemResponseType createItemResponse = _esb.CreateItem(createItemRequest);



            // Get the response messages.

            ResponseMessageType[] rmta = createItemResponse.ResponseMessages.Items;



            foreach (ResponseMessageType rmt in rmta)

            {

                ArrayOfRealItemsType itemArray = ((ItemInfoResponseMessageType)rmt).Items;

                ItemType[] items = itemArray.Items;


                // Get the item identifier and change key for each item.

                foreach (ItemType item in items)

                {


//the task id

                   Console.WriteLine("Item identifier: " + item.ItemId.Id);


//the change key for that task, would be used if you want to track changes ...
                    Console.WriteLine("Item change key: " + item.ItemId.ChangeKey);

                }

            }

        }

        catch (Exception e)

        {

            Console.WriteLine("Error Message: " + e.Message);

        }

        return itemId;

    }

这篇关于使用Exchange Web服务(EWS)托管API为其他用户创建任务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆