简体   繁体   English

无法通过使用EWS进行模拟来限制对共享日历的访问

[英]Can't limit access to shared calendar through impersonation using EWS

We're using EWS to integrate our CRM with Exchange Online 2010SP2. 我们正在使用EWS将CRM与Exchange Online 2010SP2集成。 One of the tasks: provide one calendar for Sales persons with the next rule: every Sales can see all appointments in Scheduler, but can open and see details (body) only his/her own appointment. 任务之一:为销售人员提供一个带有下一条规则的日历:每个销售人员都可以在Scheduler中查看所有约会,但只能打开和查看自己约会的详细信息(正文)。 Appointment are being placed by CRM in response of certain business events. CRM会根据某些业务事件进行约会。 We tried to use impersonate and Sensitivity.Private property. 我们尝试使用模拟和Sensitivity.Private属性。 Appointment is being placed with impersonated user name, but it can't be opened by that user neither through OWA nor via Outlook. 约会使用模拟的用户名进行放置,但是该用户无法通过OWA或Outlook无法打开约会。 So it's placed as private appointment of 'master' user (user who created shared calendar and his credentials is used for service connection), he can open it in Outlook or OWA. 因此,它作为“主”用户(创建共享日历并且其凭据用于服务连接的用户)的私人约会放置,他可以在Outlook或OWA中打开它。 EWSEditor shows appointment's LastModifiedUser - correct impersonated username (not master's). EWSEditor显示约会的LastModifiedUser-正确的模拟用户名(不是主用户名)。 In Fiddler we can see 'success' Response on appointment placement request (under impersonated user). 在Fiddler中,我们可以看到对约会放置请求的“成功”响应(在模拟用户下)。 In OutlookSpy, we can see that appointments PR_SENDER_NAME_W, PR_SENT_REPRESENTING_NAME_W properties shows 'master's' username. 在OutlookSpy中,我们可以看到约会PR_SENDER_NAME_W,PR_SENT_REPRESENTING_NAME_W属性显示了“主人”的用户名。 We stuck. 我们卡住了。

Impersonated user has 'owner' rights upon that shared calendar. 模拟的用户对该共享日历具有“所有者”权限。

If Impersonating doesn't resolve this issue, can Delegate technique do that? 如果模拟无法解决此问题,代理技术可以做到吗?

Thanks in advance for any help. 在此先感谢您的帮助。

static void Main(string[] args)
{
    ExchangeService services = new 
    ExchangeService(ExchangeVersion.Exchange2010_SP2);

    services.Credentials = new WebCredentials("master@exchserver.com", 
        "MasterPwd");
    services.Url = new Uri("https://someserver.com/ews/exchange.asmx");

    FolderId rfRootFolderid = new FolderId(WellKnownFolderName.Calendar);
    FolderView fvFolderView = new FolderView(100);

    DateTime startDate = DateTime.Now.AddDays(1);
    DateTime endDate;

    string SalesCalendarId = "AAMkADVlMGVjZWVkLT....AADo8XAAA=";

    CalendarFolder folder = CalendarFolder.Bind(services, new 
    FolderId(SalesCalendarId));

    TimeSpan ts = new TimeSpan(10, 00, 0);
    startDate = startDate.Date + ts;
    endDate = startDate.AddMinutes(60);

    services.HttpHeaders.Add("X-AnchorMailbox","impersonateduser@exchserver.com");

    appointment.Subject = "from Test";
    appointment.Body = "Test";
    appointment.Start = startDate;
    appointment.End = appointment.Start.AddMinutes(30);
    appointment.ReminderDueBy = appointment.Start.AddHours(1);
    appointment.Sensitivity = Sensitivity.Private;
    ImpersonatedUserId = new ImpersonatedUserId(ConnectingIdType.SmtpAddress, "impersonateduser@exchserver.com");

    appointment.Save(SalesCalendarId, SendInvitationsMode.SendToNone);
}

You could use impersonated user to obtain 'owner' permissions. 您可以使用模拟用户来获得“所有者”权限。

Please include the code below before services.Credentials = new WebCredentials("master@exchserver.com", "MasterPwd") services.Credentials = new WebCredentials("master@exchserver.com", "MasterPwd")之前,请包含以下代码。

services.PreAuthenticate = true;

you need to make sure that we have required permissions for EWS Impersonation as per the article mentioned below: 您需要确保根据下面提到的文章,我们具有EWS模拟的必需权限:

Configuring Exchange Impersonation in Exchange 2010 在Exchange 2010中配置Exchange模拟

Using Exchange Impersonation in Exchange 2010 在Exchange 2010中使用Exchange模拟

You could reference the following link: 您可以参考以下链接:

Get all calendar events for a specific user 获取特定用户的所有日历事件

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM