我正在使用.net core和Angular使用日历API。 我使用Google Calendar API完成了所有步骤。 现在,我想使用Outlook Calendar API做到这一点。 所以首先我需要一个Angular中的函数,以便我可以连接到我的帐户ang得到一个代码(Oauth2) 我将在后端使用它来获取我的令牌(因为我想在我的databe中注册它们)。 好吧,这是我使用Google API的功能
handleAuthClick() {
let self = this;
gapi.auth2.getAuthInstance().grantOfflineAccess()
.then(value => {
const optionsParams = {
params: new HttpParams()
.set('code', value.code)
};
self.http.get("http://localhost:59933/api/UserCode", optionsParams)
.subscribe(data => {
console.log(data);
})
});
}
我想我可能需要在函数中使用这个link还是需要一个库? 任何人都可以帮助使用Outlook Calendar API的功能 谢谢
答案 0 :(得分:1)
建议使用Microsoft Graph API访问包括Outlook在内的Microsoft 365服务。
对于Angular,您可以参考教程:Get started with Microsoft Graph and Angular。它在Angular中提供SDK和代码示例。
在GitHub上还有一些可用的Angular示例:https://github.com/search?q=angular+sample+user:microsoftgraph&type=Repositories
此外,您的链接显示使用授权代码流获取Microsoft Graph API(范围为https://graph.microsoft.com/user.read
)的访问令牌,您可以在基于javascript的应用程序中使用隐式流。