zoukankan      html  css  js  c++  java
  • Microsoft.SharePoint.Client 读取SharePoint 文件

    https://blog.darkthread.net/blog/access-sharepoint-doclib-with-dotnet/ 可参考它的方法.代码是通用的(它里面包括了文件夹操作等)

    我安装的包如下:

     读取文件:

       

    var ctx = new ClientContext(url);

    // Provide credentials
    // (Might be able to skip this if the server is on prem and your
    // AD user has permissions to access the library)
    var password = new SecureString();
    foreach (var c in "Sharepoint密码".ToCharArray())
    {
    password.AppendChar(c);
    }

    ctx.Credentials =
    new SharePointOnlineCredentials("Sharepoint账号", password);

    var t= Microsoft.SharePoint.Client.File.OpenBinaryDirect(ctx, "/这一段路径 ");

    MemoryStream ms = new MemoryStream();
    t.Stream.CopyTo(ms);

    --注意这里出来的t里的流是不能直接操作的.这里传的路径 是除了https://xxxx.sharepoint.com/这一段路径  ,要注意前面的/ 不能少. 这个路径可以通过 在线查看  选择在桌面应用打开. 然后再找到下图的位置复制出来(注意 不需要最后的参数)

  • 相关阅读:
    python opencv PyQt5
    各大web服务器https的证书文件
    mysql 常用字符串操作
    python 修改字符串中的某一位字符
    python mysql
    小程序
    m4a 转MP3
    安装python 3.7
    树莓派版本信息
    bash 重启后台程序脚本
  • 原文地址:https://www.cnblogs.com/itstac/p/13936530.html
Copyright © 2011-2022 走看看