4 Answers Found

I call the following Web Part code my "Jump to an event List" dropdown.Written just for my good friend Monty.

It runs thru the current site locating Event lists and populating adropdown list of options for the user to choose from. If there are noEvent list, it renders some text instead. Let me know what you think...

This is almost what I was doing, but I didn't know about theSPListTemplateType.Events.. I was just gathering all basetype lists this helpsa lot.

However, the key piece that I'm missing is that I want to be able to point to anevents list on the base portal site (a global company events calendar) and thenbe able to export the dwp and add it to any area or wss site and have it pullfrom the same global events list rather than just a list on the current site - Ineed some way to get to the list on another site - I figured the easiest waywould be to type in the url for the site and then maybe show a dropdown of thelists available. I've found that you can do this by using SPSite objSite = newSPSite(http://www.mysite.com) to get the site in the url, but this should onlywork for the top level site (sitecollection), and I'm not sure yet what happenswhen you try to open a SPSite at the address of an SPWeb -- Is there adifference I need to worry about? Is there a better way to do this?

The other minor change I have in the code is that the DropDownList is in acustom toolpart.

I'll gladly share the code when I'm done, but would also like feedback on howyou could generalize the option that I'm adding for coloring days on thecalendar for events of a certain type.. Right now I have added an extra columncalled "Type" which provides choices.. each choice shows with a different colorbackground (these choices can never have dates that overlap). This alows us tosee important information at a glance like holidays, timesheet due dates,paydays, etc. I've hard coded a switch statement to provide the backgroundcolors right into the web part, but I'd like to make it more dynamic than that..Any suggestions? Anyone else interested in the final code? If so I'll justpost it here.

Always remember to dispose of SPSite and SPWeb objects or your memoryfootprint could overcome the server.

For the second question, I wonder if you couldn't create a ToolPart thatused a technique similar to the way that SharePoint lets us ordercolumns on a ListView. But instead of sequence numbers, you would useunique colors. You would present a list of Types based upon the uniquevalues in the Events List and to the right of each Type would be a dropdown list of colors. When the user choose a different color for a givenType the rest of the drop down lists would reshuffle so that they wouldall be unique. You could potentially even reuse Microsoft's JavaScriptfor reshuffling the drop downs (I've done that before). Then you wouldstore a delimited list of values as a custom property for the order ofcolors the end user has chosen. If the custom property is empty you usea canned color sequence, otherwise you use the color order chosen by theend user. As long as you consistently retrieve the list of Types in thesame sequence you would never actually have to store the Type that wasrelated to a given color.

Go4Sharepoint, is a Microsoft Featured Community.
Microsoft, Windows, Sharepoint, Sharepoint logo, Windows logo, etc are trademarks of the Microsoft Corporation.
All product names, logos, copyrights, and trademarks mentioned are acknowledged as the registered intellectual property of their respective owners. This site is not in any way affiliated with, nor has it been authorized, sponsored, or otherwise approved by, Microsoft Corporation.