Quote of the day SharePoint webpart

Just another utility to have in your arsenal but very useful and very commonly asked by some customers. Pretty trivial to develope however only part that needs a bit of thinking is how to randomly generate a quote on a daily basis.

To begin, Create a sharepoint list that looks something like this –

Title (Single Text) Quote (Multiple lines of text )
Albert Einstein Put some famous text here
Oscar Wilde Put something here

Now we need to write a javascript code that will use EcmaScript(javascript) client object model to randomly pick one item from this list and display. I have not used any ‘random’ function – the key is to get the current date as a number such as 20140226 ( for 26 feb 2014) and apply modulus operator with the no of items in the list.

Feel free to download the code from HERE.

 

 

Trackbacks

Leave a Comment

Your email address will not be published. Required fields are marked *