If you want to perform CRUD operation on SharePoint Online lists, for that you can use C# code with console app or window app or else create web application.
The same requirement i was also having. So i used C# console application.
And yes you need to authenticate first, and for authentication you can use Username and Password into the code itself which will encrypt your credentials before sending over network. I used this mechanism for authentication.
For more details regarding Authentication you can refer this thread Authenticating client with office 365/SharePoint online
You can create the Provider Hosted App and using this you can perform CRUD operation on SharePoint Web Hosted list.
For getting started with SharePoint Provider Hosted App you can go through Get started creating provider-hosted SharePoint Add-ins
Let me know if i missed something in the answer.
If you want create a list item from outside the SharePoint Environment then you can use following code.
using (ClientContext clientContext = new ClientContext("your sharepoint online site url"))
{
SecureString passWord = new SecureString();
foreach (char c in "your password".ToCharArray()) passWord.AppendChar(c);
clientContext.Credentials = new SharePointOnlineCredentials("your username", passWord);
Web web = clientContext.Web;
clientContext.Load(web);
clientContext.ExecuteQuery();
var myList = clientContext.Web.Lists.GetByTitle("your list name");
ListItemCreationInformation listItemCreate = new ListItemCreationInformation();
Microsoft.SharePoint.Client.ListItem newItem = myList.AddItem(listItemCreate);
newItem["Title"] = "Item added by Job at " + DateTime.Now;
newItem.Update();
clientContext.ExecuteQuery();
Console.WriteLine(web.Title);
Console.ReadLine();
}
It worked for me. The above code is just console application. You can convert it into GUI also.
And for reference purpose you can refer this link Call O365 using CSOM with a Console Application
Let me know if you face any issue in running above code.
If you want to create an list item using REST API Service call then please refer this discussion CRUD Operations in Sharepoint Online using JavaScript on external site