Tell me more ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

Hi I have 2 external lists 'A' and 'B'. with an associated column in A, that looks up for B. When i view/edit item in browser, it shows correct values as shown in picture below.

enter image description here

But when i try to access the list in code, i can access all column values, but associated column value comes null. The code look something like this :

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);

                            }


                        }
share|improve this question

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.