I am writing a webpart for SharePoint 2007 and have 1 problem with accessing list by a webpart.

I have a list with lets say 10 fields and I am using this fields by a webpart without problem. But after adding new field to a list and trying to use it in a webpart i got exception about missing field.

To access list I am using LINQ like this:

listitems = (from SPListItem item in items
    where string.IsNullOrEmpty(Filter) || string.IsNullOrEmpty(item[FilterColumn] as string) || (item[FilterColumn] as string).Split().Contains(Filter.Trim())
    let url = GetUrl(item[ImageUrl] as string)
    let ext = item[IsExternal].ToString().ToLower() == "true"
    let linkUrl = GetUrl(item[LinkColumn] as string)
    let linkDescription = GetUrlDescription(item[LinkColumn] as string)
    let desc = item[ImageDescription] as string
    let alt = item[ImageAlt] as string
    select new CarouselItem() { ImageUrl = url, Link = linkUrl, LinkDescription = linkDescription, ImageAlt = alt, ImageDescription = desc}).ToList();

And problem exists in newly created column IsExternal.

Of course under properties "ImageUrl" etc are proper values.

I have checked also in couple of SharePoint tools this column and I can see it in CAML Query Viewer and other tools. Only my webpart does not see it.

Do you have any possible solution for this?


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.