I have a web part I'm creating that displays links in a metro style fed from a compatible list. I'm pretty new to share point development and was wondering how can I make sure a compatible list is available in the site (im guesssing i need to create a content type) or how can I trigger the creation of a compatible list to feed the webpart and then link the webpart to that list. I was thinking that perhaps i could add a button to the webpart properties panel that will create the list when clicked. Im not sure to be honest. Any ideas are welcome.
is this what your looking for?
Creates a new list:
Update list item(s):
You can add a button to the webpart properties that triggers the code above ;)
hope it helps :)
Best way to ensure is to create the list with object model at webpart feature activation
See, after deploying webpart you have to activate the web part feature, in that feature activation event (FeatureActivated event receiver) write your code that will create the list for you, you can also write code for list deletion at feature deactivation depending upon your choice
The way I would do it:
The user who adds the webpart should also create a new list for it. Creating lists and adding webparts to the page is probably not a daily activity. So I am not sure if it's worth investing any more time in a more sophisticated approach.
I hope it helped.