Catégorie : Niveau intermédiaire

How to read a remote file and convert it to a Base64 string [JavaScript]

This code is based on the one found on StackOverflow — it’s compatible with IE8+, and all modern browsers: // get the remote file binary content function getBinary(file, callback) { var convertResponseBodyToText = function(e) { return e }; var xhr = new XMLHttpRequest(); xhr.open(« GET », file, true); if (xhr.overrideMimeType) xhr.overrideMimeType(« text/plain; charset=x-user-defined ») else { // for IE8 […]

« En attente d’éléments à copier » et « attente de l’application des modifications » [iOS]

Avec la sortie d’iOS 8 j’ai voulu mettre à jour mon iPad. Malheureusement, au moment de restaurer mes données, iTunes m’indique : « En attente d’éléments à copier » et tourne dans le vide pendant un long moment. En fait j’ai découvert que cela était dû à des applications qui ne doivent pas être compatibles, […]

Problem with the People Picker of Sharepoint

For one of my list I’ve had a very weird issue: one people picker didn’t work properly. If I entered a name and clicked to check it, then it didn’t work. If I saved it and then got back to the form, the value didn’t appear. This strange behavior is due to a missing SPAN […]

How to edit the default action for an icon in a Sharepoint Ribbon

I wanted to change the behavior of the « Edit Item » button from the Sharepoint 2010 ribbon of the Display Form (DispForm.aspx). It wasn’t really easy, so I finally found a solution that I’m going to share here. You’ll need to use JavaScript for that. In the below example, the click on the « Edit Item » will […]

Show/Hide a Sharepoint fields in the NewForm, EditForm and DispForm

With the Sharepoint WebServices it’s possible to hide a field into the NewForm, the Editform and/or the DispForm. You’ll need to use JavaScript with jQuery and SPServices. It’s the UpdateList service that will do the trick. Once you have loaded the both librairies you can use the below code: var fieldsToUpdate = ‘<Fields>’; fieldsToUpdate += […]

Delete a User Custom Action from Sharepoint [JavaScript]

The MSDN documentation is a nightmare…. For example Microsoft provides an example to create a User Custom Action for Sharepoint, however there is no code about how to delete it. So here is the code to use to delete the usercustomaction just created with the above example: var siteUrl = ‘/site collection/site/’; function deleteUserCustomAction() { […]

Dynamically inject a CSS code into the page [JavaScript]

Mozilla created a function that permits to inject some CSS into the document: addStylesheetRules() But if you use jQuery you may want to use this function: function injectCSS(rule) { $(« head »).append(‘<style>’ + rule + ‘</style>’) } // example injectCSS(« div { padding:5px } »)

Show the full content of a Sharepoint Calendar event box

With a Sharepoint Calendar the events with a long title/description are cropped and you cannot see the full description, except if you move your mouse over it. Example: So I’ve had to do some CSS and a complicated JavaScript code to be able to create some large boxes. Now we are able to see the […]

FreeFileSync with size only comparison

FreeFileSync is a powerful backup tool for Windows, Linux and Mac that permits to save over the network to a WebDAV drive for example. They can be very useful with some cloud services like Box.com. However, it’s best to use the comparison by size only, and not size AND date. The reason is that some […]

Partage sous Windows 7 et « System error 53 has occurred. »

Ma configuration réseau est un peu particulière : j’ai un ordinateur (machine A) sous Windows 7 en WORKGROUP (avec un login et un mot de passe), et une autre machine Windows 7 du boulot avec un login/pass sur un domaine (machine B). Pour réussir à se connecter aux disques partagés de la machine A, voici […]