0

こんにちは、「A」と「B」という 2 つの外部リストがあります。Bを検索するAの関連列。ブラウザでアイテムを表示/編集すると、下の図に示すように正しい値が表示されます。

ここに画像の説明を入力

しかし、コードでリストにアクセスしようとすると、すべての列の値にアクセスできますが、関連する列の値は null になります。コードは次のようになります。

                            items = listReports.GetItems();

                            System.Collections.Generic.List<ReportItem> reportItems = new List<ReportItem>();
                            foreach (SPListItem it in items)
                            {
                                if (it != null)
                                {

                                    ReportItem item = new ReportItem();
                // extItem comes null
                var extItem = it["ExtCol"];
                // extItem comes null

                  DateTime date;
                                    if (DateTime.TryParse(it["GeneratedOn"].ToString(), out date))
                                    {
                                        item.dateGenerated = date.Date;
                                    }

                                    DateTime time;
                                    if (DateTime.TryParse(it["GeneratedOn"].ToString(), out time))
                                    {
                                        item.timeGenerated = time.Date;
                                    }

                                    reportItems.Add(item);

                                }


                            }
4

1 に答える 1

0

よくわかりませんが、「ExtCol」は、外部型のフィールドの正しい名前ですか? 外部アイテムの場合、sharepoint は、ソース フィールド名の外部アイテム/列の名前を置き換えることができます。

于 2013-03-14T12:14:24.597 に答える