Catégorie : Programmation

Détecter si le Freebox Player est allumé ou éteint (en veille) via les API de Free [Programmation]

Il n’existe pas de commande directe qui permette de savoir si le Player est éteint (en veille) ou allumé… Cependant il existe une astuce qui consiste à faire une requête en utilisant les paramètres suivants : { url: »http://mafreebox.freebox.fr/api/v3/airmedia/receivers/Freebox%20Player/ », headers:{ « X-Fbx-App-Auth »: client.app.session_token }, method: »POST », json: { « action »: »stop », « media_type »: »video » }, encode: »utf-8″ } La Freebox va alors retourner […]

Execute an action before saving a form but after the form validation [Sharepoint]

Let’s say you want to do an asynchronous request just before saving a Sharepoint form, but after Sharepoint verified all the fields in your form (for mandatory ones, or for format, …). Here is my solution to do it (using jQuery.Deferred): // this function will do our asynchronous check function beforeSaving() { var deferred=jQuery.Deferred(); setTimeout(function() […]

Disable X-Frame-Options on Sharepoint

I needed to communicate with an iframe on Sharepoint, however Sharepoint returned Load denied by X-Frame-Options … To override this limitation you have to create a Webpart page where you’ll add the code <WebPartPages:AllowFraming runat= »server » /> into the <asp:Content> section (that might work somewhere else, but I did this way). You can also add it […]

Hide a field into a form with JSLink based on field’s description [Sharepoint]

On Sharepoint 2013 I was trying to hide a field (the complete row) based on some elements into its description. To do so we will call our file using the JSLink (see my previous post about it). The JS file looks like that: (function() { // do some actions as soon as the fields are […]

Bypass a lookup field not displayed because of threshold on NewForm and EditForm [Sharepoint 2013]

EDIT 22/Dec/2016: there is s a new version of this article at https://blog.kodono.info/wordpress/2016/12/22/2-bypass-a-lookup-field-not-displayed-because-of-threshold-on-newform-and-editform-sharepoint-2013/ Sharepoint is really annoying to limit the access to the list with more than 5,000 items… It causes many troubles, and one of them is when you use a lookup field into a form that is tied to a big list. Sharepoint […]

Load a script once a DispForm is fully shown in Sharepoint 2013

Sharepoint 2013 introduced the JSLink. This is very useful to play with forms and views. My attempt here is to remove some rows from the DispForm. To do so I needed to trigger an action as soon as the fields rendering has been done. After different tries, I finally came up with the PostRender option. […]

Add a SharePointWebControls into a HTML version of a MasterPage [Sharepoint 2013]

In Sharepoint 2013 it’s now possible to create the MasterPage based on an HTML file. Here is the snippet you need to add into your HTML page to get a SharePointWebControls: <!–SPM<%@ Register Tagprefix= »SharePointWebControls » Namespace= »Microsoft.SharePoint.WebControls » Assembly= »Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c » %>–> <!–CS: Start Create Snippets From Custom ASP.NET Markup Snippet–> <!–SPM:<SharePointWebControls:TextField runat= »server » FieldName= »Title » />–> <!–CE: End […]

Get color_id from a Google Calendar using API [PHP]

For a project I needed to get the events from a Google Calendar, as well as the colors from it. It’s been a pain, but after a couple of days I’ve been able to create a PHP page to do so. It will use the server-to-server auth mechanism. I’ll try to provide the different steps […]

Play with ribbon on Sharepoint

In Sharepoint 2010 and 2013, there are some existing functions to deal with the ribbon. Below an example of what we can do: // we need the file « sp.ribbon.js » SP.SOD.executeOrDelayUntilScriptLoaded(function () { // use PageManager var pm = SP.Ribbon.PageManager.get_instance(); // define a function to call when the ribbon is loaded var DoSomethingWithRibbon=function(ribbon) { // For […]