Suppose i have multiple features inside my wspbuilder. That includes a list definition, and a webpart.

  1. I want to fetch the records / items inside list, into my webpart. how we can do this ?

  2. As i explained , i have a list definition in my WSPBuilder project. the requirement is, to set the lookup field on that list itself on ID Or Title column. Can we do this ? What i have to do.

  1. Use a SPQuery object. But you should develop what you want to do. There is often native components that can do the job with a small amount of work

  2. either use the AddLookupMethod, or do the stuff in the list definition. The later way is quite hard, because the list definition schema is not always properly handled by SharePOint code. I also have to add, that the lookups needs to be used with precaution. You have to create the target list, then the child list (can't create the lookup on a non existing field)

| improve this answer | |
  • Thanks for reply Steave B, I would also use SPQuery. I have more interest in programming itself not in xml stuffs. But i observe as i added blank feature in WSPBuilder project, i got there reciever class with some events structure. which event is suitable to define the list definition and set the lookup field ? – Red Swan Jun 21 '11 at 12:17
  • I use to add the lookup in the feature receiver that create the child list instance. – Steve B Jun 21 '11 at 12:19
  • ok, Which event is suitable to create list definition – Red Swan Jun 21 '11 at 12:35
  • sorry, I meant list definition, not list instance. the idea is to monitor the feature activated event (the feature with the list definition), and add the lookup from this event – Steve B Jun 21 '11 at 12:36
  • ok so sequence will: in Feature Activated event , create the custom list and once it get created add lookup field in same event. right? What should do on FeatureInstalled event ? – Red Swan Jun 21 '11 at 13:03

Your Answer

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

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