Independentsoft
- any library, any programming language
Home
Purchase
Support
Company
Contact
Share .NET
>
Tutorial
> Create list item
The following example shows you how to create a list item.
C# example
using System; using System.Net; using System.Collections.Generic; using Independentsoft.Share; namespace Sample { class Program { static void Main(string[] args) { try { Service service = new Service("https://independentsoft.sharepoint.com", "username", "password"); ListItem item = new ListItem("Column1"); ListItem createdItem = service.CreateListItem("dbf4c193-34ee-4719-901e-4f2aa290883a", item); Console.WriteLine("Id: " + createdItem.Id); Console.Read(); } catch (ServiceException ex) { Console.WriteLine("Error: " + ex.Message); Console.WriteLine("Error: " + ex.ErrorCode); Console.WriteLine("Error: " + ex.ErrorString); Console.WriteLine("Error: " + ex.RequestUrl); Console.Read(); } catch (WebException ex) { Console.WriteLine("Error: " + ex.Message); Console.Read(); } } } }
VB example
Imports System Imports System.Net Imports Independentsoft.Share Namespace Sample Class Module1 Shared Sub Main(ByVal args As String()) Try Dim service As New Service("https://independentsoft.sharepoint.com", "username", "password") Dim item As ListItem = New ListItem("Column1") Dim createdItem As ListItem = service.CreateListItem("dbf4c193-34ee-4719-901e-4f2aa290883a", item) Console.WriteLine("Id: " + createdItem.Id) Console.Read() Catch ex As ServiceException Console.WriteLine("Error: " + ex.Message) Console.WriteLine("Error: " + ex.ErrorCode) Console.WriteLine("Error: " + ex.ErrorString) Console.WriteLine("Error: " + ex.RequestUrl) Console.Read() Catch ex As WebException Console.WriteLine("Error: " + ex.Message) Console.Read() End Try End Sub End Class End Namespace
Need help? Ask our developers:
Name*
Email*
Message*