使用O365 auth_flow_type='credentials'时遇'messages'资源未找到错误
问题:切换凭证认证后提示“Resource not found for the segment 'messages'”
为跳过登录流程,我将代码中的认证类型从authorization改为credentials,但始终收到错误提示:Resource not found for the segment 'messages'。我尝试调整Azure权限设置,但没有解决问题。
代码示例
import sys import os from O365 import Account,FileSystemTokenBackend credentials = ('3c7adf9b-3126-45d9-8239-3a9a66dbaae3','J8Q8Q~--------------------------') token_backend = FileSystemTokenBackend(token_path=os.getcwd()+'/token_folder/', token_filename='my_token.txt') account = Account(credentials, auth_flow_type='credentials', tenant_id='f3aaaf31-b8db-4e24-b8a3-----------',token_backend=token_backend) if account.authenticate(): print('Authenticated!') mailbox = account.mailbox(resource = 'wo----------------hotmail.onmicrosoft.com') messages = mailbox.get_messages(limit=1500) for message in messages: print(message.subject)
输出截图

Azure设置截图
内容的提问来源于stack exchange,提问作者Wolfgang
相关产品推荐
相关产品推荐




