List SPNS in Active Directory

Short script found on social.technet.microsoft.com. Please follow the link for further info.

 

SharePoint 2013 – Enable Ratings on a list programatically via the REST API

I have searched a lot and been through much trial and error trying to get this to work. So I thought it might benefit someone if I share it.

For this article it is assumed that you are used to working with the SharePoint REST API. If not, MSDN has a lot of great articles with examples on this. Make sure to also include the X-RequestDigest  header when sending POSTs to SharePoint (Google “SharePoint X-RequestDigest REST POST” for more info – or let me know if this needs elaboration :)).

1 Create a list

Use the REST API or whatever method you prefer. See the Create a list example at MSDN for an example on how to do it via the REST API.

2 Create the needed fields

In order to specify the field IDs and FieldRefs while creating the fields via REST, we are going to be using the createfieldasxml method located at http://<site url>/_api/web/lists/GetByTitle('LISTTITLE')/fields/createfieldasxml . We need to POST the following data in order to create a field. I have included the needed XML for each field in the Field list below. Do 1 post for each field changing the XML FROM THE FIELD LIST BELOW to the XML for the field.

Field list

3 Set the Ratings_VotingExperience property on the list

This is done by posting the following data to  http://<site url>/_vti_bin/client.svc/ProcessQuery . Change the LISTTITLE to the title of your list.

And you are done. The list now has Likes enabled.

This article was written in a short amount of time and therefore, is not very elaborate. Please let me know if it needs more examples or further explanations.

Happy coding 🙂

Visual Studio 2015 & Angular-CLI – Cannot find namespace ‘webdriver’

I recently got the following error in Visual Studio 2015 while working on a project generated by Angular-CLI (1.0.0-beta.21).

Solution was to install Selenium package and Selenium-Webdriver types using the following command

Hopefully this may help someone else searching Google 🙂

Sync Office 365 shared calendar with IOS and Android

After signing up for Office 365 and setting everything up on 2 computers, phones and tablets, I were very surprised to find that IOS and Android is not able to display calendars shared from Office 365.

There are some work arounds involving the OWA app (not as intuitive as using the native calendar app), publishing the calendar (making it available for all who has the link) or setting up a joined shared calendar (not as user friendly due to having to use 2 calendars, and also not able to differentiate the calendar entries by color).

The solution: Install Team Calendar Sync on the IOS / Android devices that needs to access the shared calendars. This will sync the shared calendars allowing the user to displaying it as any other native calendar. It does cost around 7 Euros, but that is certainly worth the cost until Microsoft and IOS / Android becomes better friends.

Home Labbing – Installing SharePoint 2013 on Server 2012 R2

I had a great deal of issues trying to follow the Microsoft TLG named “Configure SharePoint Server 2013 in a three-tier farm” (which is located at https://technet.microsoft.com/en-us/library/hh872914.aspx.

The issues were all related to the prerequisite installer which gave errors regarding IIS, Server Mangager and other requirements.

I finally got it to install using the following steps.

1 – Install required Roles and Features

Run the following script in PowerShell (taken from the KB article at https://support.microsoft.com/en-us/kb/2765260)  to install required Roles and Features. NOTE: Server must be connected to the internet, which, since this is for a home lab, I’m okay with while the installer runs. If you do not wish to connect your server to the internet, you can insert the Server 2012 R2 installation media and specify the source by entering the -Source parameter for the command (see the KB article)

2 – Fix path to Servermanager.exe

The prerequisite installer looks for the Server Manager at c:\windows\System32\ServerManagerCmd.exe but in Server 2013 R2 it’s located at c:\windows\System32\ServerManager.exe. Copy and rename it manually or by running the following PowerShell command.

3 – Run the prerequisite installer and close Server Manager after it launches

Run the prerequisite installer. This will open up the Server Manager window which you need to close. If you leave it open, the prerequisite installer will get stuck on configuring IIS. NOTE: This step will also require the server to be connected to the internet. If you do not want to do so, make sure that you download and install the requirements manually (I have not covered this due to this being a guide for a home lab).

Happy Labbing 🙂

SharePoint 2013 – Add client-side People Picker to plain HTML page

After spending many hours (more than I’m willing to admit) getting the SharePoint 2013 client-side People Picker working in a plain HTML page, I’m going to document the solution here. Hoping that it will help others trying to accomplish the same.

The code example Using the client-side People Picker in a SharePoint-hosted add-in in this MSDN article (which many reference) will not work in a plain HTML page due to a couple of reasons.

  1. It’s ASP.NET code which will not be run in a plain HTML page.
  2. Some JavaScript dependencies are added automatically by ASP.NET and is therefore not shown in the example.

I found the missing JavaScript dependencies by running the example in an .aspx page and checking which scripts were being included.

To get it working, first strip the ASP.NET parts and then include all the scripts. Below I’ve also included the corev15.css file which included the needed CSS for the People Picker.

Happy coding 🙂

 

Setup Visual Studio 2015 for Angular2

I’ve recently started in a new job which requires knowledge of TypeScript and Angular2 and would like to share my findings on setting up the tools for this.

The following is based on a great guide by Cory Rylan which can be found at his blog and several post on StackOverflow and misc Google results.

What to install and configure

NodeJS

Download it from this location and make sure you choose the Current version (v6.3.0 as this is written). Install when you have downloaded it.

Visual Studio 2015

Download it via your msdn account or get the community edition from this location.

Select the following Features during install

After the installation has finished, open Visual Studio and navigate to Tools > Options > Projects and Solutions > External Web Tools and set it up as the following image shows. This is to make Visual Studio use the latest NodeJS instead of the build-in older version.

visual-studio-set-up-nodejs-version

Python

Download it from this location and choose the 2.7.xx version. After installing, run the following commands in a Command Prompt to configure NPM.

NPM Task Runner extension for Visual Studio (optional)

Download it from this location. This will allow you to run scripts configured in package.json inside Visual Studio.

TypeScript for Visual Studio

Download it from this location or search for it in Tools > Extensions and Updates in Visual Studio.

After installing it, replace typescriptservices.js located at C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\CommonExtensions\Microsoft\TypeScript\typescriptServices.js with the one available at https://raw.githubusercontent.com/Microsoft/TypeScript/Fix8518-U3/lib/typescriptServices.js. This is in order to avoid errors like Invalid module name in augmentation (see this Stack Overflow post regarding this) NOTE: The one I’ve linked to is for Visual Studio 2015 Update 3. If you’re using another version you should check the linked Stack Overflow post for info.

Other issues

Behind a proxy?

If you’re behind a proxy, you need to setup NPM and Typings up for this.

NPM in the Command Prompt

You need to run the following commands in a Command Prompt:

NPM in Visual Studio

You need to add the following to machine.config located at C:\Windows\Microsoft.NET\Framework\v4.0.30319\Config

Typings

(this works for both the Command Promt and Visual Studio.)

You need to create a file named .typingsrc in the root folder (same as the one containing the package.json and typings.json). It should contain the following

Visual Studio is chrashing when saving packages.json

You need to right click packages.json and choose Include in Project.

tsc.exe exits with error -1

When this happens the packages.json is often missing as well.

Install Microsoft.TypeScript.MSBuild and Microsoft.TypeScript.Compiler using the NuGet package manager console.

What else?

I’ll try to keep this post updated with my finding as I go along. But do check out the blog post by Cory Rylan I mentioned in the beginning. He does a much better job at explaining why some of the settings are needed.

Have a great time writing Angular2 in Visual Studio 🙂

By the way: Images for this post was taken while following the excellent introduction to Angular2 The Hero Editor at angular.io.

Show me the local administrators

The need for easily displaying all local administrators on a computer does not come up all that often. But when it does it would be neat to not have to go through direct members, members by groups (and nested groups) in order to locate all the local administrators on a computer. The below script do this for you so that you may spend your time on better things.

Download script

Generate XML files for MusicBee containing AudioAddicts radio stations

For a long time I’ve been looking for a solution to generate XML files which contains all radio stations provided by AudioAddict (di.dm, radiotunes.com, rockradio.com, etc).

I’ve only been able to find a couple of old solutions which did not support adding my premium key (which grants access to higher bitrate streams with no adds).

Since I’ve previously used PowerShell to both get content from a webpage and to manipulate XML, I thought it might be a fun exercise to create a script that 1. scraped the station info from the websites and 2. added the station info to an XML file that can be used for importing into MusicBee. Cool beans! This is what I ended up with.

 

Download script