Posts

Showing posts from February, 2018

Event Registration Sharepoint 2013

SP doesn't provide any OOB way to stop registration if seats are filled. Or any way to unregister from an event. To do this I created 2 code blocks, one for registration and another for unregistering. The basic idea was from this blog when I was searching for any code to do this. However this uses the Infopath. Since Infopath is becoming obsolete, I had to create ajax and java script updates to lists. Register and Unregister from an event Steps to Follow 1. Create Create 2 lists "Events" & "Volunteer Signup" I will provide steps to perform for the code to execute. Register <script language="javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js" type="text/javascript"></script> <script type="text/javascript"> $(document).ready(function() { SP.SOD.executeFunc('sp.js', 'SP.ClientContext', getCurrentUser); document.getElementById("Meetin

Multivalue Dropdown Refiner Sharepoint 2013

Filter Multivalue dropdown.html <html xmlns:mso="urn:schemas-microsoft-com:office:office" xmlns:msdt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882"> <head> <title>Multi-value Dropdown Refinement Item</title> <!--[if gte mso 9]><xml> <mso:CustomDocumentProperties> <mso:CompatibleManagedProperties msdt:dt="string"></mso:CompatibleManagedProperties> <mso:TemplateHidden msdt:dt="string">0</mso:TemplateHidden> <mso:CompatibleSearchDataTypes msdt:dt="string"></mso:CompatibleSearchDataTypes> <mso:MasterPageDescription msdt:dt="string"></mso:MasterPageDescription> <mso:ContentTypeId msdt:dt="string">0x0101002039C03B61C64EC4A04F5361F385106604</mso:ContentTypeId> <mso:TargetControlType msdt:dt="string">;#Refinement;#</mso:TargetControlType> <mso:HtmlDesignAssociated msdt:dt="string"

Anniversary Web part SharePoint JavaScript

Image
Create a Refinable Property like Refinabledate according to the requirement. Go to site settings > Search schema. In the managed properties, search for refinabledate00(if this is already mapped select an empty one) and map it to the SPS-Anniversary crawled property(by default sharepoint crawls the AD user profile properties with a prefix of SPS-). Run a full crawl for the refinabledate to get all the info generated. To test if refinable property has values run a search query https:// yoursitecollurlhere /_api/search/query?querytext=%27*%27&sourceid=%27B09A7990-05EA-4AF9-81EF-EDFAB16C4E31%27&selectproperties=%27Title,Refinabledate01,Path%27&sortlist=%27Refinabledate01:ascending%27&rowlimit=500 Once you get a set of results as below, you can paste the url into the below code Once you get results for the query, iterate through results with condition according to which dates you want to show the birthdays for. For this you need to get the current date which is in

Birthday Javascript Sharepoint 2013

Below is the code to pull birthdays using REST API search Sharepoint 2013. Create a Refinable Property like RefinableString or Refinabledate according to the requirement. In my case I had to try both and had an issue with Refinabledate since the month was getting appended to the year. Lets say someone has mar 23rd as birthday in User profile property, the date was showing as 01-03-2023. Hence I had to assign it to a string. Since in our environment it was a dd-mmm(no year) format which was a custom profile property, It was showing 23rd-March in my case. Once RefinableString02 was assigned it was showing the same dd-mmm format. For getting the right url you need to have the querytext as * and source id to the people, and select the properties required which is  "Title,RefinableString02,Path". Then fire an ajax query as below with the rest url as below:https://yoursitecollurl/_api/search/query?querytext=%27Refinabledate00%3E%222-7-2000%22%27&sourceid=%27B09A7990-05E