SPMetal Issues

Oct 15, 2011 at 4:06 PM

Hi there,

I seem to be having issues with generating classes using SPMetal when there are SharePoint 2010 Filtered Lookup Fields. The classes are generated, but the properties for the filtered lookup fields are not. Has anyone else had this issue or similar?

Thanks in advance,

-Pat Ramadass

Oct 15, 2011 at 5:09 PM

Hi there again,

After further investigation and trial/error it seems that simply adding similar code (either to the generated SPMetal class or preferably to another partial class) to what would be generated by SPMetal for a normal lookup field seems to work.

Thanks,

-Pat Ramadass

Coordinator
Oct 21, 2011 at 8:04 AM

Hi!
I know that SPMetal has some problems with custom fields. I can't test it now with the filtered lookup field, but maybe you can try to extend the mapping generated by SPMetal.
Try to follow this page of the sdk: http://msdn.microsoft.com/en-us/library/ee538669.aspx

Peppe

Oct 21, 2011 at 11:29 AM

Hi there again,

Thanks for the response. Yes, it seems like it’s any non SharePoint Foundation “normal” fields including the filtered lookup, some cross site lookups etc.

Have extended some of the classes where the filtered lookup was used, but having some issues with others as well. Will have a look at that reference.

Thanks,

-Pat Ramadass

Nov 2, 2011 at 2:07 PM

Hey there again,

Further to this it seems like our situation was complicated as a mixture of...

-Normal Lookups

-Normal Lookups on Site Columns

-Filtered Lookups

...were used. In one case specifically there was a Filtered Lookup to a List on a parent site which didn't have a Site Column defined for it. We couldn't seem to extend the classes to work with this so have had to resort to creating a new Site Column and adding a new column for this followed by copying all the data across. If you have specifically solved this type of situation in a different way it would be good to know how.

Thanks,

-Pat Ramadass