string client = Dts.Variables["SPclient"].Value.ToString(); string user = Dts.Variables["SPuser"].Value.ToString(); string pass = Dts.Variables["SPpass"].Value.ToString(); MessageBox.Show(client + " " + user + " " + pass); //Debug style NetworkCredential credentials = new NetworkCredential(user, pass); ClientContext clientContext = new ClientContext(client); /* NetworkCredential credentials = new NetworkCredential(user, pass); ClientContext clientContext = new ClientContext(client); Web site = clientContext.Web; List list = site.Lists.GetByTitle("Projects"); try { // Load Credentials for authentication clientContext.Credentials = credentials; // Load the site clientContext.Load(site); // Load the site list clientContext.Load(list); // Execute queries clientContext.ExecuteQuery(); MessageBox.Show("Title: {0}", site.Title); // Load the folders var folders = list.RootFolder.Folders; clientContext.Load(folders); // Execute the queries clientContext.ExecuteQuery(); // Create a new folder and execute the query var newFolder = folders.Add("TESTSSISFOLDER"); clientContext.ExecuteQuery(); } catch (Exception e) { MessageBox.Show(e.ToString()); }
I am trying to run this script in SSIS and I get this error http://img96.imageshack.us/img96/3585/helphj.png
after only these 2 lines of code.
If I try to run the whole script (the commented block) in a standalone console application, it works, but it errors in the Script Task when I set the ClientContext.
Any ideas to why this is happening?
Thanks in advance!