Hello,
I am writing C# code to get all list names from SharePoint Online site. I have referenced the below given DLL's with respective namespaces. But still it is throwing error on Code Check. Can someone please assist?
Type: Error
Description: Compiler error at top section line 5: The type or namespace name 'Runtime' does not exist in the namespace 'Microsoft.SharePoint.Client' (are you missing an assembly reference?)
(All DLLs are in local Blue Prism Automate folder)
System.dll
System.Data.dll
System.Xml.dll
System.Drawing.dll
Microsoft.SharePoint.Client.dll
Microsoft.SharePoint.Client.Runtime.dll
System.Linq.dll
Here is my code:
public string GetSPOnlineListItems(string siteurl, string username, string password)
{
string result = "";
try
{
using(var ctx = new ClientContext(siteurl))
{
var passWord = new SecureString();
foreach (char c in password.ToCharArray())
{
passWord.AppendChar(c);
}
ctx.Credentials = new SharePointOnlineCredentials(username, passWord);
Web web = ctx.Web;
ctx.Load(web.Lists, lists => lists.Include(list => list.Title, list => list.Id));
ctx.ExecuteQuery();
foreach(List list in web.Lists)
{
result = result + list.Title;
}
}
}
catch (Exception ex) { result = result + "Error is: " + ex.Message; }
return result;
}
------------------------------
Thanks,
Faraz
------------------------------