用于访问 SPO 列表的 SSIS Visual C# 脚本组件

问题描述

我已将所有代码写入控制台解决方案中,并且运行良好。当我尝试将该代码作为源引入 SSIS 脚本组件时,我收到以下错误

Script Component Runtime Error

我也包含了我试图测试的一小部分代码。此代码已被修剪到发生错误的地方。我已经在控制台解决方案中测试了这个确切的代码,它执行时没有任何错误

   public override void CreateNewOutputRows()
    {
        string siteURL = "https://XXXXXXXXX.sharepoint.com/XXXXXX";
        string userName = "XXXXXXXXXXXXX";
        string password = "XXXXXXXXXXXXX";

        //Create the client context object and set the credentials  
        ClientContext clientContext = new ClientContext(siteURL);
        securestring securePassword = new securestring();

        foreach (char c in password.tochararray())
            securePassword.AppendChar(c);

        clientContext.Credentials = new SharePointOnlineCredentials(userName,securePassword);

        //Load the web  
        Web web = clientContext.Web;

        clientContext.Load(web);

        List oList = clientContext.Web.Lists.GetByTitle("XXXXXXXXXXXXX");
        clientContext.Load(oList);
        clientContext.ExecuteQuery();

        Output0Buffer.AddRow();
        Output0Buffer.Match = "TRUTH";
    }

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)