Office365 API-管理员访问其他用户/房间';s日历事件

Office365 API-管理员访问其他用户/房间';s日历事件,office365,outlook-restapi,Office365,Outlook Restapi,通过点击此请求: 在浏览器中,我可以输入我的管理员用户名和密码,并获取该特定房间的日历事件。 但是,当我尝试从具有管理员身份验证的本机应用程序拨打此电话时,我得到以下响应: reason=“调用应访问oauth令牌中指定的邮箱。”;错误\u category=“无效\u授权” 我如何才能获得作为管理员身份验证的特定房间的日历事件?目前,我们只允许访问属于已验证用户的邮件、日历和联系人。因此,此时不支持管理员访问conf.room日历的场景。访问属于其他用户的资源(如conf.room calen

通过点击此请求: 在浏览器中,我可以输入我的管理员用户名和密码,并获取该特定房间的日历事件。 但是,当我尝试从具有管理员身份验证的本机应用程序拨打此电话时,我得到以下响应: reason=“调用应访问oauth令牌中指定的邮箱。”;错误\u category=“无效\u授权”
我如何才能获得作为管理员身份验证的特定房间的日历事件?

目前,我们只允许访问属于已验证用户的邮件、日历和联系人。因此,此时不支持管理员访问conf.room日历的场景。访问属于其他用户的资源(如conf.room calendar)在我们的支持路线图上,但我们还没有时间与您共享

同时,你有两个选择

选项#1:如果您能够在服务器上运行应用程序,您可以构建需要管理员同意的服务应用程序,但有权访问Office 365租户中的任何邮箱。您需要使本机应用程序与服务器上运行的应用程序对话。有关更多详细信息,请参见此


选项2:您可以使用我们的Exchange Web服务SOAP API来实现您的方案。有关此选项和相关链接的更多详细信息,请参阅。

这个小型PLUG-N-COMPILE-RUN(woo-hoo!)Java类应该演示如何访问房间资源用户事件日历。Azure V2.0 REST API当前不允许这样做。确保对Exchange服务进行身份验证的身份验证用户是要检索其事件的房间资源用户日历的“委托人”。您的Exchange/Office365管理员可能需要为您进行设置。我在这里获取了JavaEWSAPI:EWS-Java-API-2.0.jar和javadoc.jar,这是一个很好的参考。如果转到Github repo:,还可以使用Maven、Gradle或其他方法将API集成到代码中。《入门指南》是……嗯……我不懂这些话(有充分的理由)。这样说吧,你最好使用一下你的搜索引擎,以找出如何做其他事情!查看Javadoc中的类对我有很大帮助。够了废话废话。。。关于代码:(哦,我包括了所有的导入!当我得到一段代码样本时,我总是讨厌它,我不得不去寻找和寻找导入。不过,我还是把它留给你去连接实际的库!如果你能走到这一步,你就不再是代码尿布了!;-)

包com.on.and.play
导入java.net.URI;
导入java.util.ArrayList;
导入java.util.Calendar;
导入java.util.Date;
导入java.text.DateFormat;
导入java.util.HashMap;
导入java.util.List;
导入java.util.Map;
导入java.text.simpleDataFormat
导入microsoft.exchange.webservices.data.core.service.item.Appointment;
导入microsoft.exchange.webservices.data.core.service.schema.AppointmentSchema;
导入microsoft.exchange.webservices.data.core.service.folder.CalendarFolder;
导入microsoft.exchange.webservices.data.search.CalendarView;
导入microsoft.exchange.webservices.data.credential.ExchangeCredentials;
导入microsoft.exchange.webservices.data.core.ExchangeService;
导入microsoft.exchange.webservices.data.core.enumeration.misc.ExchangeVersion;
导入microsoft.exchange.webservices.data.search.FindItemsResults;
导入microsoft.exchange.webservices.data.property.complex.FolderId;
导入microsoft.exchange.webservices.data.search.FolderView
导入microsoft.exchange.webservices.data.core.service.schema.FolderSchema
导入microsoft.exchange.webservices.data.search.FindFoldersResults
导入microsoft.exchange.webservices.data.search.filter.SearchFilter
导入microsoft.exchange.webservices.data.core.enumeration.search.FolderTraversal
导入microsoft.exchange.webservices.data.core.service.item.item;
导入microsoft.exchange.webservices.data.core.service.schema.ItemSchema;
导入microsoft.exchange.webservices.data.property.complex.Mailbox
导入microsoft.exchange.webservices.data.search.ItemView;
导入microsoft.exchange.webservices.data.core.PropertySet;
导入microsoft.exchange.webservices.data.property.definition.PropertyDefinition
导入microsoft.exchange.webservices.data.credential.WebCredentials;
导入microsoft.exchange.webservices.data.core.enumeration.property.WellKnownFolderName;
导入microsoft.exchange.webservices.data.core.enumeration.property.BasePropertySet;
导入microsoft.exchange.webservices.data.core.exception.service.local.ServiceLocalException
导入java.net.URI;
类MyTestService{
公共列表getRoomCalendar(){
ExchangeService服务=新的ExchangeService(ExchangeVersion.Exchange2010_SP2);
//替换somebodyreal@somewhere.com有一个真实的电子邮件地址
//代表ConferenceRoom@somewhere.com.您的exchange管理员可能会
//我需要为你设置。
交换基本凭证
=新的WebCredentials(“somebodyreal@somewhere.com",
“他们的明文密码上帝保佑微软”;
服务。设置凭据(凭据);
service.setUrl(新URI(“https://outlook.office365.com/EWS/Exchange.asmx"));
//服务。自动发现URL(“toddp@touchsource.com", );
FolderView fv=新FolderView(100);
setTraversal(FolderTraversal.Deep);
//替换ConferenceRoom@somewhere.com使用资源的电子邮件地址
FolderId confRoomFolderId=新的FolderId(WellKnownFolderName.Calendar,
新邮箱(“ConferenceRoom@somewhere.com"));
List apntmtDataList=new ArrayList();
Calendar now=Calendar.getInstance();
Date startDate=Calendar.getInstance().getTime();
现在。添加(Calendar.DATE,30);
Date endDate=now.getTime();
试一试{
CalendarFolder CalendarFolder=CalendarFolder.bind(服务,confRoomFolderId);
C