Geeks With Blogs

News Cloud development with Azure, Visual Studio and SharePoint Online!
Thorvald Bøe jquery
Create a multi line rich text field in a SharePoint list using REST
I recently needed to create a rich text field in a SharePoint list programatically. Since I am using REST all over the place, it would be practical to continue that now as well.I was able to find out how to create a new field. It is done by posting to this url: reqUrl = appweburl + "/_api/SP.AppContextSite(@t... + listName + "')/fields?@target='" + hostweburl + "'";For example like this:$.ajax({ url: reqUrl, type: "POST", data: "{ '__metadata': { 'type': 'SP.Field' }, 'Title': ......

Posted On Thursday, January 14, 2016 12:32 PM

Creating a SharePoint list item from an app/add-in part - fun with form digest
Ok, I will try not to make this a rant, but after knocking my head against the proverbial wall for several hours, that is going to be a tough one, LOL.The problem was seemingly trivial: Create a SharePoint hosted add-in part with a button that creates an item in a list in the host web.After all, I have been working with list items quite a bit from the SP hosted add-in, so doing it from an add-in part should not be so difficult, right? Wrong!As you might know, when modifying a sharepoint list (e.g. ......

Posted On Tuesday, October 6, 2015 8:48 PM

Add default values for date fields in list edit forms using moment.js
I love the SharePoint lists, they are so easy to set up and customize. I use it all the time.Still, there is room for improvement. The display/new/edit forms for example, are not very customizable OOTB. However, by making some very simple tweaks, you can make great improvements. This time I had a form displaying a couple of date fields, where it was desired to display default values based on some simple logic.The basic problems here are:1.SharePoint has very limited functionality for default values ......

Posted On Friday, March 6, 2015 9:51 AM

Sending email with SharePoint and jQuery
Want to send email from SharePoint using jQuery? No problem!No need to create workflows or set up SMTP servers, just use this simple function:function sendEmail(from, to, body, subject) { var siteurl = _spPageContextInfo.webServe... var urlTemplate = siteurl + "/_api/SP.Utilities.Utility... $.ajax({ contentType: 'application/json', url: urlTemplate, type: "POST", data: JSON.stringify({ 'properties': { '__metadata': { 'type': 'SP.Utilities.EmailProperties' }, 'From': from, 'To': ......

Posted On Thursday, July 3, 2014 3:58 PM

SharePoint and jQuery loading nightmares
SharePoint is great. jQuery is great. Together, they are brilliant! At least that is how it is supposed to be, but unfortunately there are a few caveats here that can lead to some nightmareish random async error situations.I spent quite a few hours debugging exactly such a situation in a recent project. Maybe these experiences will help someone in a similar situation.The task:Create two web parts, let's call them the project web part and the quote web part. They will be built using jQuery and display ......

Posted On Tuesday, May 13, 2014 2:36 PM

Solving cross domain issues
I had the following scenario:1 SharePoint onPremise site installed on IIS port 801 Dynamics NAV site with some web services to be utilized on the SharePoint siteMy task was to create some web parts to display project information coming through the NAV web services. As I have used the content editor web part with jQuery pattern very successfully in the past, I saw no reasons why it shouldnt work this time. It did, but I ran into a few hickups.First, I needed to consume the web services from jQuery. ......

Posted On Tuesday, February 18, 2014 12:57 PM

Disable a people picker field in SharePoint 2013 with jQuery
jQuery is a nice tool when working with SharePoint, because it lets you create behaviour that is not available using standard configuration and improve usability and business value of your solution.Still, it is not always trivial to perform seemingly trivial tasks with jQuery and SharePoint, because you are so much closer to the metal and the inherent complexity of SharePoint gets in the way of simple tasks.I think for the future, Microsoft would gain from providing a client side library for manipulating ......

Posted On Sunday, February 2, 2014 2:37 PM

Display in image from a picture library in SharePoint 2013 using Javascript and REST
Having jumped on the SharePoint bandwagon not too long ago, means that sometimes you end up in a situation where you are "just going to do a simple thing" and it turns out that:a) It is not so simple, andb) Finding information is even less simpleI often find myself in this situation, and since I don't have a decade of SharePoint experience to fall back on, I will have to rely on my old friend Google. Fortunately we have a long and understanding relationship, and even though this time it was harder ......

Posted On Tuesday, January 28, 2014 10:03 AM

Javascript and SharePoint rich text fields
When programming against SharePoint using Javascript and REST, there is a little gotcha when using the "multiple lines of text" type in a list. When retrieving a value for this type of field, the result is by encoded to support rich text, like this:If you want to simply retrieve and use the text value, you've got a problem. My first thought was to decode the string using some kind of jquery method. This is not so simple as it seems, and while there are ways to get it done, you will still be in trouble ......

Posted On Thursday, January 9, 2014 3:57 PM

Nested promises...
The title of my first blog post could possibly have been taken from a poorly written love song, but it's not. Instead it is from some (hopefully not so poorly written) javascript code.Ok, so this javascript world is kind of new to me. Not that I haven't used javascript for the last 13 years or so, it's more that my acceptance of javascript as a full fledged development tool is kind of new to me. With javascript libraries popping up all over and it being promoted as a knight in shiny armour to recue ......

Posted On Wednesday, November 20, 2013 4:11 PM

Copyright © Thorvald Bøe | Powered by: GeeksWithBlogs.net