0

I was wondering if it's possible to create a content type using C# that has two columns, the second column looks up the first column.

eg.

Title | myColumn

myColumn should be a lookup column and it looks up 'Title' from the same content-type I want construct.

Using the AddLookUp() constructor expects a [Name], [ListId/Guid], [Required]. Unfortunately there is no list to reference reference the lookup as the lookup column is in the same content type that I want to create.

I did a bit of digging on the web and Google but haven't found anything using C# but found something similar in the blogs below talking about self referencing list.

http://hristopavlov.wordpress.com/2008/05/15/lookup-fields-to-the-same-list-defined-as-a-site-column/

http://www.novolocus.com/2008/04/25/self-referencing-lookup-columns/

My question is, is this 'doable' using SharePoint's server object model?

1 Answer 1

1

You can't create a lookup to a content type, only to a list - which makes sense because content types don't hold data, they merely define what data looks like.

So what you need to do is create the list, then add the lookup column back to the list content type.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.