简体   繁体   English

Exchange Web服务托管API:访问其他用户项

[英]Exchange Web Services Managed API: Accessing other users items

Is it possibly to access the folders and items of other Exchange accounts other than the one of the logged in user? 是否可以访问除登录用户之外的其他Exchange帐户的文件夹和项目?

Can I do this via Exchange Web Services Managed API? 我可以通过Exchange Web服务托管API执行此操作吗?

Yes it is possible, but you should know the password of the other user or grab in some ways this credentials ( NetworkCredential object). 是的,这是可能的,但您应该知道其他用户的密码或以某种方式获取此凭据( NetworkCredential对象)。 The typical first lines of you code could be 你代码的典型第一行可能是

ExchangeService myService = new ExchangeService (ExchangeVersion.Exchange2007_SP1);
myService.Credentials = new NetworkCredential ("user@mycorp.local", "P@ssword00");

so you can access Exchange Server Web Services with the account which is other as the current user. 因此,您可以使用其他作为当前用户的帐户访问Exchange Server Web服务。 See ExchangeService object description for more information. 有关更多信息,请参阅ExchangeService对象描述。

If you are an admin you can make user impersonation by SMTP address . 如果您是管理员,则可以通过SMTP地址进行用户模拟

Knowing the password is wrong and using impersonation (these days) is wrong. 知道密码是错误的并且使用模拟(这些天)是错误的。

Here's how you do it. 这是你如何做到的。

        ExchangeService _service = new ExchangeService(ExchangeVersion.Exchange2010_SP2);
        //CREDENTIALS OF AN ACCOUNT WHICH HAS READ ACCESS TO THE CALENDAR YOU NEED
        _service.Credentials = new WebCredentials(username, password);
        _service.Url = new Uri(serviceURL);

        SearchFilter.SearchFilterCollection searchFilter = new SearchFilter.SearchFilterCollection();
        searchFilter.Add(new SearchFilter.IsGreaterThanOrEqualTo(AppointmentSchema.Start, DateTime.Now.AddDays(-1)));
        searchFilter.Add(new SearchFilter.IsLessThanOrEqualTo(AppointmentSchema.Start, DateTime.Now.AddDays(2)));
        ItemView view = new ItemView(50);
        view.PropertySet = new PropertySet(BasePropertySet.IdOnly, AppointmentSchema.Subject, AppointmentSchema.Start, AppointmentSchema.AppointmentType, AppointmentSchema.End);

        //THIS NEXT LINE!!!
        var calendarSearch = new FolderId(WellKnownFolderName.Calendar, new Mailbox("email@ofsomemailbox.com"));
        var appointments = _service.FindItems(calendarSearch, searchFilter, view);

I suggest to use impersonation instead of login for each user. 我建议使用模拟而不是每个用户登录。 Via impersonation you can impersonate users. 通过模拟,您可以冒充用户。 Its not the same like full access. 它与完全访问权限不同。 Full access is on behave of, impersonation is act as. 完全访问是表现的,模仿就是充当。

A pre of impersonation is you have one username and password instead of having x usernames and passwords. 假冒的前提是你有一个用户名和密码,而不是x用户名和密码。

You can use impersonation like this way: 您可以像这样使用模拟:

ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2010);
service.Credentials = new NetworkCredential(appName, appPassword, emailDomain);
service.ImpersonatedUserId = new ImpersonatedUserId(ConnectingIdType.SmtpAddress, userToImpersonate);

when a user has delegate access to someone else, you can access the folder of the other user. 当用户具有对其他人的委托访问权限时,您可以访问其他用户的文件夹。 For example: Person A will be impersonated and is able to access Person B 例如:人员A将被模拟并且能够访问人员B.

暂无
暂无

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

相关问题 如何使用Exchange Web服务查找其他用户的日历项目 - How to use Exchange Web Services to find calendar items for other users 使用C#中的Exchange Web服务托管API检索错误的邮箱项目 - Wrong mailbox items being retrieved using Exchange Web Services managed API in C# Folder.Bind - “Id格式错误” - Exchange Web服务托管API - Folder.Bind - “Id is malformed” - Exchange Web Services Managed API 在 Exchange 中访问 email 属性 web 服务器托管 API - Accessing email properties in Exchange web server managed API 在iOS应用程序中访问Microsoft Exchange Server Web服务(EWS)API - Accessing Microsoft Exchange Server Web Services (EWS) API in an iOS application 如何在托管的Exchange Web服务中更改AppointmentStatus - How to change AppointmentStatus in managed Exchange Web Services 使用Microsoft Exchange Services托管API,当要同步的项目超过512个时会发生什么? - Using the Microsoft Exchange Services Managed API, what happens when there are more than 512 items to sync? C# 交换 Web 服务托管 API 模拟 -> Microsoft Graph ZDB974238714CA8DE634A7CE108A14F - C# Exchange Web Services Managed API Impersonation -> Microsoft Graph API 如何使用Exchange Web服务托管API列出这些文件夹中的所有文件夹和文件? - How to list all folders and files in those folders using Exchange Web Services Managed API? 从Exchange Web服务托管API获取收件箱中的所有邮件,并将其存储为.eml文件 - Fetching all mails in Inbox from Exchange Web Services Managed API and storing them as a .eml files
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM