Hi @Eliasen, Jan ,
SharePoint Online is using OAuth authentication instead of Windows/NTLM Authentication, needs the additional access token.
So I suggest you could use SharePoint Online CSOM instead of Lists.asmx, as Lists.asmx is always used in SharePoint Sever environment and now Lists.asmx has been deprecated:
choose-the-right-api-set-in-sharepoint
Back to the requirement, if want to get the list item of a list, please try the following code snippet:
string userName = "user@Tenant.onmicrosoft.com";
string AppPassword = "your password";
var securePassword = new SecureString();
foreach (char c in AppPassword)
{
securePassword.AppendChar(c);
}
using (var context = new ClientContext("https://tenant.sharepoint.com/"))
{
context.Credentials = new Microsoft.SharePoint.Client.SharePointOnlineCredentials(userName, securePassword);
Web web = context.Web;
context.Load(web);
context.Load(context.Web.Folders);
context.ExecuteQuery();
List list = web.Lists.GetByTitle("MyList");
ListItemCollection items = list.GetItems(CamlQuery.CreateAllItemsQuery());
context.Load(items);
context.ExecuteQuery();
}
SharePoint Online CSOM can be download and install using Nuget:
Install-Package Microsoft.SharePointOnline.CSOM -Version 16.1.20720.12000
Microsoft.SharePointOnline.CSOM
If an Answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.