问题描述
我编写了一个简单的 python 脚本来获取我公司租户中用户的收件箱。此特定用户的许可证是 Office F3。这是我的代码:
import O365
from O365 import Account,Connection,MSGraPHProtocol,Message
scopes=['basic','message_all']
credentials=('user@domain','password')
account = Account(credentials = credentials)
if not account.is_authenticated: # will check if there is a token and has not expired
account.authenticate(scopes=scopes)
account.connection.refresh_token()
mailBox = account.mailBox()
inBox = mailBox.get_folder(folder_name='InBox')
child_folders = inBox.get_folders(25)
for folder in child_folders:
print(folder.name,folder.parent_id)
for message in inBox.get_messages(5):
if message.subject == 'test':
print(message.body)
当我运行它时,它告诉我复制并粘贴一个 url,当我点击它时,我收到以下错误:
CMD prompt when I run the code
AADSTS700016:在目录“y”中找不到标识符为“x”的应用程序。如果应用程序尚未由租户的管理员安装或租户中的任何用户未同意,则可能会发生这种情况。您可能将身份验证请求发送给了错误的租户。
有人知道怎么解决吗?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)