The following code for example will loop thru my Calendar list and delete the event with a specified ID, but you can put code in the inner code block which will take the values and write to different calendar.
var myWeb = SPContext.Current.Web;
var listItems = myWeb.Lists["Leave Calendar"].Items;
var itemCount = listItems.Count;
for (var k = 0; k < itemCount; k++)
{
var item = listItems[k];
if (requestId == Convert.ToInt32(item["RequestID"]))
{
listItems.Delete(k);
break;
}
}
And in the following code snippet is how I save items to a calendar
protected void WriteToCalendar(string title, string location, DateTime startdate, DateTime enddate, string description, string category, bool alldayevent, string requestid)
{
var myWeb = SPContext.Current.Web;
var calendarList = myWeb.Lists["Leave Calendar"];
var calendarListItem = calendarList.Items.Add();
calendarListItem["Title"] = title;
calendarListItem["Location"] = location;
calendarListItem["Start Time"] = startdate;
calendarListItem["End Time"] = enddate;
calendarListItem["Description"] = description;
calendarListItem["Category"] = category;
calendarListItem["All Day Event"] = alldayevent;
calendarListItem["RequestID"] = requestid;
calendarListItem["Approval Status"] = "Pending";
calendarListItem["Employee Name"] = title;
myWeb.AllowUnsafeUpdates = true;
calendarListItem.Update();
myWeb.AllowUnsafeUpdates = false;
}