在不使用Web服务器的情况下编写简单的Microsoft图形客户端

在不使用Web服务器的情况下编写简单的Microsoft图形客户端

问题描述:

我正在寻找编写脚本来更新Office365中的通讯组列表.我正在学习MS Graph API的过程中,并且已经使用了python REST示例.似乎所有示例Graph API代码,无论使用何种语言或平台,都假设我正在以一种或多种方式从Web用户界面进行编码.

I'm looking to write a script to update a Distribution List in Office365. I'm in the process of learning the MS Graph API and have gotten the python REST sample to work. It appears that all the sample Graph API code, regardless of language or platform, has an assumption that I'm coding from a web user interface in one way or another.

是否可以编写一个从Linux机器运行的简单客户端,并允许我在代码中指定Office 365 ID,而不必从浏览器中选择它?我的目标是使它作为一项cron作业运行,并每晚更新一次通讯组列表".并不是Python的必要条件,而是我选择开始学习Graph的地方.

Is it possible to write a simple client that runs from a Linux box and allows me to specify my Office 365 id in my code, without having to select it from a browser? My goal is to have this run as a cron job which updates the Distribution List nightly. Python is not a requirement, it's just where I chose to start in learning Graph.

Graph API不仅限于Web应用程序,也可以在本机/桌面应用程序中使用.从本质上讲,您必须首先注册您的应用程序以获取您的应用程序ID,然后使用您想要实施Auth Code Grant流的任何REST API来获取访问权限.当您第一次发出请求时,系统将提示用户使用其Office 365帐户登录以授予对您的应用程序的访问权限,然后您便离开了.

The Graph API is not restricted to web apps and can be used in native/desktop apps as well. Essentially you have to start by registering your app to get your app ID, then use whatever REST APIs you want to implement the Auth Code Grant flow to get access. When you first issue a request the user will be prompted to sign in with their Office 365 account to grant access to your app, and away you go.

https://graph.microsoft.io/en-us /docs/get-started/rest