如何通过Python将本地PowerPoint文件上载到SharePoint目录

pj2*_*452 1 python sharepoint powerpoint

我正在自动化一些报告,并且需要能够将文件上载到我有权访问的SharePoint目录.目标是通过任务计划程序(我已经知道如何设置)运行此脚本.

不知道从哪里开始,但我已经看到一些线程试图使用sharepoint和请求模块来做这件事,但仍然有点卡住.

任何帮助深表感谢.谢谢.

pj2*_*452 5

我最终按照建议查找命令行方法,并将其放在一起,效果很好:

# maps local network drive to SharePoint directory (any open drive works)
os.system('net use r: {}'.format(sharepoint_url))

# uploads updated local file to SharePoint directory
os.system('copy {} r:\{}'.format(output_file_path, output_file_name))

# disconnects mapped network drive
os.system('net use r: /delete')
Run Code Online (Sandbox Code Playgroud)

希望这可以帮助有人下线.