この素晴らしいフォーラムの専門家からの心からの支援により、SharePoint リストから返された xml を解析して、目的のリスト アイテムを C# リストに取得することができました。
XDocument xdoc = XDocument.Parse(activeItemData.InnerXml);
XNamespace z = "#RowsetSchema";
List<int> listID = (from row in xdoc.Descendants(z + "row")
select (int)row.Attribute("ows_ID")).ToList();
List<string> listTitle = (from row in xdoc.Descendants(z + "row")
select (string)row.Attribute("ows_LinkTitle")).ToList();
SQL テーブルを作成しました。Lists listID と listTitle をパラメーターとして使用して、テーブルに値を挿入したいと考えています。
System.Data.SqlClient.SqlConnection sqlConnection1 =
new System.Data.SqlClient.SqlConnection(MyconnectionString);
System.Data.SqlClient.SqlCommand cmd = new System.Data.SqlClient.SqlCommand();
cmd.CommandType = System.Data.CommandType.Text;
cmd.CommandText = "INSERT TechOpsProjectTracker (ID, [Project Name]) VALUES (@ID, @ProjectName)";
//What I want to do:
//1. @ID should get the values from the List listID: List<int> listID = (from row in xdoc.Descendants(z + "row") select (int)row.Attribute("ows_ID")).ToList();
//2. @ProjectName should get the values from the List listTitle: List<string> listTitle = (from row in xdoc.Descendants(z + "row") select (string)row.Attribute("ows_LinkTitle")).ToList();
//3. so each new record inserted in the table has ID and its corresponding Project Name. Something like this
/* ID Project Name
360 GEI Survey data to Sharepoint
378 Create back end and environment to support User demographic reporting
*/
私の仕事を達成するためのもっと簡単な方法が他にもあるかもしれません。私にお知らせください。ティア。