Month: March 2014

Creating OneNote notebooks in SharePoint via JSOM

This article has been published originally in German on the 1stQuad company blog.

With server-side code, it is fairly easy to create OneNote notebooks in SharePoint. In this article, I want to explain briefly how to achieve this with the  JavaScript Object Model (JSOM).

In a current project, one of the requirements was to create OneNote notebooks automatically in Office 365. This had to happen either with out-of-the-box functionality or via API calls (REST or JSOM). After a few tries, it turned out that doing it via JSOM seems to be the best (and only?) option.

Generally speaking, a OneNote notebook in SharePoint is nothing else but a folder that is handled in a very specific way. With server-side code, you can “turn” a regular folder into a OneNote notebook by setting the ProgId property of the corresponding SPListItem to “OneNote.Notebook”. As you can’t access ProgId via JSOM, a different way to implement this functionality has to be found. Luckily, you can achieve the same thing by setting the property “HTML File Type” of a folder.

The following code snippet shows a short example

//common variables
var context=SP.ClientContext.get_current(); 
var web=context.get_web();
var lists=web.get_lists();
var list=lists.getByTitle("Documents");

//create a new folder
var itemCreationInfo=new SP.ListItemCreationInformation();
itemCreationInfo.set_underlyingObjectType(SP.FileSystemObjectType.folder);
itemCreationInfo.set_leafName("Name of the new Notebook");

//modify the folder to convert it into a OneNote notebook
var onenoteNotebook=list.addItem(itemCreationInfo);
onenoteNotebook.set_item("HTML_x0020_File_x0020_Type" ,"OneNote.Notebook");
onenoteNotebook.update();

//send the request
context.load(onenoteNotebook);
context.executeQueryAsync(function(){
 //created successfully, do stuff if needed 
},
function(sender,args){
 //something went wrong, do stuff if needed
});

PowerShell Script to download SharePoint Conference 2014 sessions

All sessions of the SharePoint Conference 2014 have been posted already on Channel 9! If you plan to watch a lot or even all of them, here’s a little PowerShell script that will help to download them. The original is from 2012 and was created by Vlad Catrinescu, with some very minor modifications (basically added one [xml] and changed the RSS feed) it’s also working this. year.

[Environment]::CurrentDirectory=(Get-Location -PSProvider FileSystem).ProviderPath
$rss = (new-object net.webclient)

$a = [xml]($rss.downloadstring("http://channel9.msdn.com/Events/SharePoint-Conference/2014/RSS/mp4high"))

$a.rss.channel.item | foreach{
 $code = $_.comments.split("/") | select -last 1

 $url = New-Object System.Uri($_.enclosure.url)

 $file = $code + "-" + $_.creator + "-" + $_.title.Replace(":", "-").Replace("?", "").Replace("/", "-").Replace("<", "") + ".mp4"

 if (!(test-path $file))
 {
    $file
    $wc = (New-Object System.Net.WebClient)
    $wc.DownloadFile($url, $file)
 }
}

A few new SharePoint & Office 365 presentations

During the past few months, I presented a few times online, at conferences, and at user groups. All those presentations were uploaded to my SlideShare account recently.

I uploaded multiple presentations on the topic of SharePoint Online management with PowerShell due to the fact that, depending on audience, I sometimes included infos on Exchange Online / Lync Online as well. Also, I constantly update that presentation with new information, such as newly available cmdlets.

I’m speaking at the European SharePoint Conference 2014

In case you missed it, the European SharePoint Conference 2014 programme is now available and I’m delighted to announce that I am speaking at Europe’s largest SharePoint event in Barcelona, Spain from the 5-8th May 2014.

I will be conducting two sessions on “Implementing a Hybrid SharePoint 2013 and Office 365 environment” and “SharePoint Online vs On-Premises vs Hosted – Making the Right Choice”.

“Implementing a Hybrid SharePoint 2013 and Office 365 environment”

“What are the requirements to setup a hybrid SharePoint 2013 and Office 365 environment? What functionality is available in a hybrid, what is not possible, and how exactly can the two systems be integrated with each other? And how exactly do you set one up? In this session, you will get to hear about this and much more!”

 

“SharePoint Online vs On-Premises vs Hosted – Making the Right Choice”

“You’re planning to implement SharePoint, but do you need to host it in-house, or is a move to the cloud a valid option? Is an on-premises SharePoint farm a better choice than SharePoint Online? Or should you host SharePoint somewhere else in the cloud, for example on Azure? This session will give you an overview of your options, their respective benefits and drawbacks, and will show you how you can make an informed decision on which platform to choose.”

espc

The European SharePoint Conference will be run over four days and will feature over 100 informative SharePoint sessions and 6 preconference tutorials providing you with a fantastic opportunity for learning and building your SharePoint skills. Check out the full Conference Programme to see all sessions and topics that are being covered by myself and world renowned SharePoint experts.

If you want to deepen your SharePoint expertise, to understand the trend of the SharePoint market, and to learn how to leverage Microsoft Office 365 for your business, including the revolutionary Enterprise Social wave, the European SharePoint Conference is the best place to be in 2014!

 

Prices start as low as €995! There is also special group discounts for bookings of 3 or more people.

 

Book Now and I’ll see you in Barcelona in May