首页 > 解决方案 > C# 中的 Powerpoint 加载项应用程序,需要访问演示文稿所有者详细信息

问题描述

我必须在 c# 中编写一个可以连接到 OneDrive 的 Powerpoint 加载项应用程序,然后从 OneDrive 上传文件和检索文件,我还需要获取演示文稿所有者详细信息和共享详细信息(其他用户权限,可以编辑或只读)。我检查了系统环境变量,但在我的机器上找不到任何东西。如何以编程方式执行此操作?我在网上搜索过,但我找不到任何东西。请帮我解决这种类型的要求..?

标签: c#asp.net.net-corepowerpointonedrive

解决方案


您可以尝试使用 OpenFileDialog 和 SaveFileDialog 来读取/写入您的 Powerpoint 文件

using (OpenFileDialog openFileDialog = new OpenFileDialog())
{
    openFileDialog.InitialDirectory = "OneDrive";
    openFileDialog.Filter = "pptx files (*.pptx)|*.pptx|All files (*.*)|*.*";
    openFileDialog.FilterIndex = 2;
    openFileDialog.RestoreDirectory = true;

    if (openFileDialog.ShowDialog() == DialogResult.OK)
    {
       //Read the contents of the file into a stream
       var fileStream = openFileDialog.OpenFile();
       // Do your stuff   
    }
}

推荐阅读