Scenario
I want to create a SharePoint sites (dynamically) for a number of events. Each event has a corresponding ID associated with it along with other corresponding fields. Each site will have a number of custom web parts that will need to reference those fields, particularly the ID.
When I create the sites dynamically, I need to assign t开发者_运维问答hat ID to the site so that the web parts "know" which site it is. I could always parse the URL (the ID is in the URL) but I would prefer a more elegant solution.
Any best practices or ideas out there that you have done to achieve this?
You can store custom Key-Value pairs in Property Bag of the site (SPWeb). It is simple to use as well.
Check it out: http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spweb.properties.aspx
You could use a list on each web to store the information in. This would make it easier for you to aggregate the infomation later on using CrossListQuery techniques.
The downside of this approach is that listitems are slower to access than property bags.
精彩评论