I have a basic understanding of how to get to the data in a given sharepoint list. What I'm not sure of is then, how to insert this data into a seperate database (ms sql). My goal is to have this process run every thirty minutes, query the sharepoint list for any new items, then insert them into a sql table.
Here's the code I have for getting at the list:
Any ideas on how to tackle the insert process?
Here's the code I have for getting at the list:
Code:
using (SPSite curSite = new SPSite("[URL unfurl="true"]http://zanett-spdev-rb"))[/URL] //[URL unfurl="true"]http://gps.technicolor.com[/URL]
{
using (SPWeb curWeb = curSite.OpenWeb())
{
//create our query
SPQuery curQry = new SPQuery();
//configure the query
curQry.Query= @"
<Query>
<Where>
<Gt>
<FieldRef Name='Created'/>
<Value Type='DateTime'>DateTime.Now.AddMinutes(-15);</Value>
</Gt>
</Where>
</Query>
";
//get our list
SPList curList = curWeb.Lists["Notifications"];
//get the collection of items in the list
SPListItemCollection curItems = curList.GetItems(curQry);
//enumerate the items in the list
foreach (SPListItem curItem in curItems);
{
//insert into db here
}
}
curSite.RootWeb.Dispose();
}
Any ideas on how to tackle the insert process?