Exchange Web服务中的多个日历 [英] Multiple calender in exchange web service

查看:180
本文介绍了Exchange Web服务中的多个日历的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的邮箱中有多个压光机.我只能使用ews api 2.0检索作为主日历文件夹的一个日历.现在,我想要其中的所有日历,约会和会议.

I have multiple calenders in my mailbox. I can retrieve only one calender that is main calender folder using ews api 2.0. Now I want the whole list of calenders and appointments and meetings in that.

例如,我有三台压光机,其中一台是主压光机

For example, I have three calenders, and one is the main calender

  1. 日历(颜色代码:默认)

  1. Calender(color-code:default)

Jorgen(颜色代码:粉红色)

Jorgen(color-code:pink)

Soren(颜色代码:黄色)

Soren(color-code: yellow)

我可以使用下面的代码检索"Calnder"主站的所有值

i can retrieve all the values of main "Calnder", using the below code

Folder inbox = Folder.Bind(service, WellKnownFolderName.Calendar);

view.PropertySet = new PropertySet(BasePropertySet.IdOnly);

// This results in a FindItem call to EWS.
FindItemsResults<Item> results = inbox.FindItems(view);
i = 1;
m = results.TotalCount;
if (results.Count() > 0)
{
    foreach (var item in results)
    {
        PropertySet props = new PropertySet(AppointmentSchema.MimeContent, 
            AppointmentSchema.ParentFolderId, AppointmentSchema.Id, 
            AppointmentSchema.Categories, AppointmentSchema.Location);

        // This results in a GetItem call to EWS.
        var email = Appointment.Bind(service, item.Id, props);


        string iCalFileName = @"C:\export\appointment" +i ".ics";


        // Save as .eml.
        using (FileStream fs = new FileStream(iCalFileName, FileMode.Create, FileAccess.Write))
        {
            fs.Write(email.MimeContent.Content, 0, email.MimeContent.Content.Length);
        }
        i++;

现在我也想获取所有剩余的压光机时间表,但我无法得到它.

Now I want to get all the remaining calender schedules also, I am not able to get it.

推荐答案

要获取位于您自己的邮箱中的所有Calendar文件夹(如果有,则不包括您个人档案中的日历文件夹),您可以使用深度遍历并过滤具有IPF.Afpointment文件夹类的文件夹,例如

To get all the Calendar folders that are located in your own Mailbox (not including those in your personal archive if you have one) you can do a FindFolders with a Deep Traversal and filter on folders with a Folder Class of IPF.Appointment eg something like

            ExtendedPropertyDefinition PR_Folder_Path = new ExtendedPropertyDefinition(26293, MapiPropertyType.String);
        PropertySet psPropSet = new PropertySet(BasePropertySet.FirstClassProperties);
        psPropSet.Add(PR_Folder_Path);
        FolderId rfRootFolderid = new FolderId(WellKnownFolderName.Root, mbMailboxname);
        FolderView fvFolderView = new FolderView(1000);
        fvFolderView.Traversal = FolderTraversal.Deep;
        fvFolderView.PropertySet = psPropSet;
        SearchFilter sfSearchFilter = new SearchFilter.IsEqualTo(FolderSchema.FolderClass, "IPF.Appointment");
        FindFoldersResults ffoldres = service.FindFolders(rfRootFolderid, sfSearchFilter, fvFolderView);
        if (ffoldres.Folders.Count > 0) {
            foreach (Folder fld in ffoldres.Folders) {
                Console.WriteLine(fld.DisplayName);
            }
        }

对于共享日历,您需要使用 EWS-访问所有共享日历

For Shared Calendars you need to use something like EWS - Access All Shared Calendars

欢呼 格伦

这篇关于Exchange Web服务中的多个日历的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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