EWS API – The specified folder could not be found in the store if share Calendar with FolderPermissionLevel.FreeBusyTimeAndSubjectAndLocation

huangapple go评论95阅读模式
英文:

EWS API - The specified folder could not be found in the store if share Calendar with FolderPermissionLevel.FreeBusyTimeAndSubjectAndLocation

问题

我正试图使用EWS API自动化以下场景:

  • user1使用权限级别'FreeBusyTimeAndSubjectAndLocation'与user2共享他的日历
  • user1在他的日历中创建一个事件
  • user2尝试获取有关user1事件的信息

设置权限的方法

public void iWantFolderPermission(String email) throws Exception {
    PropertySet propSet = new PropertySet(BasePropertySet.IdOnly, FolderSchema.Permissions);
    // 指定新用户的SMTP地址和文件夹权限级别。
    FolderPermission fldperm = new FolderPermission(email, FolderPermissionLevel.FreeBusyTimeAndSubjectAndLocation);

    // 绑定到文件夹并获取当前权限。
    // 此调用会导致对EWS的GetFolder调用。
    Folder sentItemsFolder = Folder.bind(service, WellKnownFolderName.Calendar, propSet);

    // 将新用户的权限添加到已发送项目DACL。
    sentItemsFolder.getPermissions().add(fldperm);
    // 此调用会导致对EWS的UpdateFolder调用。
    sentItemsFolder.update();
}

但是当我尝试从共享的日历中获取事件时,我收到错误消息 - microsoft.exchange.webservices.data.core.exception.service.remote.ServiceResponseException: 无法在存储中找到指定的文件夹。

如果我将权限设置为FolderPermissionLevel.Reviewer,则一切正常运行。
那么为什么使用权限级别FreeBusyTimeAndSubjectAndLocation无法访问共享日历呢?

英文:

I'm trying to automate next scenario with EWS API:

  • user1 shares his calendar with user2 with permission level 'FreeBusyTimeAndSubjectAndLocation'
  • user1 creates an event in his calendar
  • user2 tries to get info about user1 event

Method to set permission

public void iWantFolderPermission(String email) throws Exception {
    PropertySet propSet = new PropertySet(BasePropertySet.IdOnly, FolderSchema.Permissions);
    // Specify the SMTP address of the new user and the folder permissions level.
    FolderPermission fldperm = new FolderPermission(email, FolderPermissionLevel.FreeBusyTimeAndSubjectAndLocation);

    // Bind to the folder and get the current permissions.
    // This call results in a GetFolder call to EWS.
    Folder sentItemsFolder = Folder.bind(service, WellKnownFolderName.Calendar, propSet);

    // Add the permissions for the new user to the Sent Items DACL.
    sentItemsFolder.getPermissions().add(fldperm);
    // This call results in a UpdateFolder call to EWS.
    sentItemsFolder.update();
}

But when I try to get event from shared Calendar I get an error - microsoft.exchange.webservices.data.core.exception.service.remote.ServiceResponseException: The specified folder could not be found in the store.

If I set permission to FolderPermissionLevel.Reviewer then everything works just fine.
So why shared Calendar can not be accessed with permission level FreeBusyTimeAndSubjectAndLocation?

答案1

得分: 1

FreeBusyTimeAndSubjectAndLocation仅在使用GetUserAvailability操作时提供对有限信息子集的访问 https://learn.microsoft.com/en-us/exchange/client-developer/web-service-reference/getuseravailability-operation 然后约会详细信息将在CalendarEventArray中返回。若要直接访问folderitems,您需要至少具有查看者权限。

英文:

FreeBusyTimeAndSubjectAndLocation only gives you access to a limited subset of information when using the GetUserAvailiblity operation https://learn.microsoft.com/en-us/exchange/client-developer/web-service-reference/getuseravailability-operation the Appointment details are then returned in CalendarEventArray. To be able to access the folderitems directly you need to have at least reviewer rights.

huangapple
  • 本文由 发表于 2020年9月15日 19:40:55
  • 转载请务必保留本文链接:https://go.coder-hub.com/63901072.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定