I’ve been away for a week or so with my new born so haven’t been able to write much BUT now I got a few moment and decided to give a tip/idea on a chalenge I used to have.
A client wanted me to allow users to see a “New” Icon or similar indication in the left navigation to certain areas. Also the client wanted the users to be able to see how many items where unread since the user last time visited a particular location in the clients intranet.
Rather simple actually, use your user profiles and property bag values at web application level OR site level.
What I did was the following:
- Created a new user property that held key value pair separated by a pre-defined character(you can chose the character). The Key was an identification to the location to which the application logic in the left navigation must be applied. The Value is a datetime value when the user last visited that location.
- Next I created a web application property bad value that had different locations which I needed the left navigation to take into consideration to the wanted logic by the client demands. This can simply be what ever you want it to be, URL, GUID etc. Just make sure that you create an understandable code for the entire process right from the user profiles, to the property bag locations and to the main logic in the left navigation.
- Lastly the most important is the left navigation logic. Here we simply attach ourselves to the left navigation rendering. Check which left navigation item in currently at display compared to the list of location in the web app property bad. IF there is a match then check the current logged users user profile for a last visited datetime value and compare it to the present date. Next find out how many new items(pages, documents, list items etc) where created since last time. Display a new icon indication and/or how many of unread items are there.
That’s it. This was back with MOSS, yyyyyeeeaaars ago :). Today you can use different ways to apply these methods but something similar might be in place.
PS: Instead of using property bag values to define locations to process you can make a “Settings” list at the root web which will be easier to handle both by you AND the user admins or content editors etc. Just have two fields in the settings list “Key” and “Value”. Create a centralised piece of code logic to handle the settings list so that you do not have to write the same code multiple times. HINT: Design Patterns with Object oriented programming and design. NOTICE: I highly recommend that the value field has as it’s data type complex text that allows HTML and/or XML. You might want later to be able to add/store XML data that is used in your application logic, even objects from code. If you do this at an early stage you will save yourself trouble later or when you do not need to modify an existing settings list and its data.