Categories
Configuring

SharePoint 2016 IT Preview on Azure

Assuming you have a MSDN subscription or any other kind of Azure license and wanting to try out SharePoint 2016, here are the steps to follow to install a SharePoint 2016 IT Preview Virtual Machine in Azure.

It’s good to know there is a pre-baked SharePoint 2016 IT Preview Virtual Machine already in the Azure Virtual Machine gallery. This way you only have to install SQL server and configure SharePoint correctly. This can be done in an hour.

Log in to Azure

Log in to Azure and go straight to the old Azure portal (if you aren’t already there). This is because the Virtual Machine isn’t available with the new look and feel or they’ve done a good job in hiding it.

Go to the old Azure portal

Deploy a Virtual Machine from the gallery

Head to the Virtual Machine Gallery, select the SharePoint category on the left and select the SharePoint Server 2016 IT Preview image.

2015-10-21 11_20_22-Start

2015-10-21 11_23_48-Clipboard

Choose a unique name for the Virtual Machine name like sp2016paarhuis I’m using.

Which Tier and Size?

Now, if you wan’t to use this SharePoint machine on a regular basis and are stuck to an MSDN subscription the Basic Tier with an A3 is the best option. This is sufficient for such a machine and it will fit just in a MSDN Premium subscription without having to turn it off. But if you just want to try it out once or twice you can go with the Standard Tier and a D12, just for speed.

Choose a username and password and continue.

2015-10-21 11_32_24-Photos

On the next two pages change the Region to your zone and keep the rest as-is and finish the wizard.

2015-10-21 11_35_27-Photos

Wait for the machine to be provisioned and started, this might take a few minutes.

2015-10-21 11_41_20-Photos

Once the machine is up-and-running you can connect with the machine (using the Connect button in the Azure portal). You will see that there is no Active Directory yet (which is highly recommended) and no SQL Server which is also mandatory for the single server SharePoint farm. The only thing pre-installed is the SharePoint setup.

2015-10-21 11_52_57-Start

Configure Active Directory

On the Server Manager add an Active Directory server role. Select the Active Directory Domain Services role and accept installing the required features.

2015-10-21 11_54_06-Program Manager

 

2015-10-21 11_57_01-Clipboard

Installation doesn’t require the server to restart so you can choose whatever you want in the last step at the automatic restart.

2015-10-21 12_00_53-Start

Now wait for the installation to finish. I’m getting a coffee if you don’t mind.

Now promote the server to a domain controller.

2015-10-21 12_09_07-Xbox

Click Add a new forest and specify a root domain name like my dev.local.

2015-10-21 12_10_50-Start

On the next screen just fill in a DSRM password and continue the wizard leaving all default settings.

2015-10-21 12_12_14-Start

You can ignore the warnings, just click Install.

2015-10-21 12_15_16-Clipboard

The machine will reboot. You need to reconnect using the domain credentials, dev\jeffrey in my case, to connect as the domain admin.

The AD and DNS are now all finished, next step is SQL.

Installing SQL Server 2014

Find a way to get the the SQL Server 2014 with SP1 ISO on the Virtual Machine. I downloaded the Enterprise Edition ISO from MSDN. If you’re experiencing any issues downloading files in Internet Explorer, set the Internet zone Security settings to Default level.

Mount the ISO and start installing SQL Server 2014, choose to install a new SQL Server stand-alone installation.

2015-10-21 12_55_55-Photos

At Setup Role choose the SQL Server Feature Installation option.

2015-10-21 14_04_23-Photos

Install the Database Engine and the Full-Text Search and also the complete Management Tools.

2015-10-21 14_07_53-Start 2015-10-21 14_08_19-Start

Warning! At the Server Configuration select the Network Service (NT AUTHORITY\NETWORK SERVICE) for both the Agent and Database Engine. The default accounts cripple the installation.

2015-10-21 14_56_52-Photos

Continue the wizard, add the current user as admin and start the installation.

2015-10-21 14_18_14-Photos

If SQL is installed all and well, the final step is to configure SharePoint.

Configure SharePoint

Before starting the SharePoint configuration we need to create a SharePoint service account. Go to Active Directory Users and Computers and add a new user named spfarm.

2015-10-21 15_54_02-Jump List for Remote Desktop Connection

Just like any other service account fill in a password and only select the Password never expires option and finish the user creation process.

2015-10-21 15_56_03-Jump List for Remote Desktop Connection

Now, open the SharePoint 2016 Products Configuration Wizard from the Windows start menu.

 

2015-10-21 15_47_30-Start

On the second screen of the wizard, choose to create a new server farm and click next.

2015-10-21 15_50_10-Photos

For the Database Access Account we use the newly created SharePoint farm user, the database server is localhost.

2015-10-21 16_00_35-Photos

Continue the wizard by filling in a passphrase. At the Specify Server Role screen you will have to select the Singe-Server Farm.

2015-10-21 16_04_23-Photos

Choose a central admin port (or not) and continue the wizard until the configuration of SharePoint begins.

When the setup is done you will be taken to the Central Administration site. SharePoint is now completely installed and you’re ready to create your web application and site collection. If you wan’t me to take you through the process of creating a site collection, please read on.

Create web application and site collection

In central admin, don’t follow the configuration wizard, but configure it yourself.

2015-10-21 22_05_22-Clipboard

Under Application Management go to Manage Web Applications. Click New to create a new web application. Use the default settings to create the main root web application.

2015-10-21 22_10_38-Jump List for Remote Desktop Connection 2015-10-21 22_10_56-Jump List for Remote Desktop Connection

Creating the web application can take a few minute, after a while the process will be done and you’re good to go to create the site collection. Go back to Application Management and go to Create site collections.

2015-10-21 22_21_54-Alarms & Clock.

Your new web application will be automatically selected. Here you will have to fill in a site title, select a template and add yourself as the primary site collection administrator.

2015-10-21 22_23_58-OneNote

Create the new site collection and when finished you’re left with the option to head to the newly created site directly by clicking the link displayed.

2015-10-21 22_27_06-OneNote

And finally we’re done.

2015-10-21 22_29_56-Clipboard

Categories
Good to know SharePoint Talk

MS Exchange Public Folders – Why everyone is migrating to Office 365 Cloud?

Public folders are as old as Exchange Server itself. But with Microsoft gradually reducing the importance of public folders from Exchange 2007 onwards, its future does not seem bright. Also, requirements of organizations are growing beyond the scope of Exchange Public folders. Collaboration specific products like SharePoint and cloud platforms like Office 365 are becoming more and more attractive to organizations. Here, we will just enquire why Public folders are losing their sheen.

  1. Exchange Public folders are for simple sharing only
    Public folders are not meant for document sharing or data archiving. Public folders lack comprehensive features for document sharing, versioning, and document management. For such tasks, Microsoft recommends using SharePoint. Also, it is not a good practice to use Public folders for archiving data.
  2. Public folders are not growing
    Public folders, with the exception of switching its location from Public folder database to Mailbox database to take advantage of its high availability, have not changed much. It hasn’t added any remarkable features to it. This makes Public folders almost an outdated feature. More innovative and advanced products and services like SharePoint and Office 365 are now available for organizations from Microsoft itself.
  3. Administrative difficulties
    Managing Public folders isn’t as easy as accessing and sharing its data. Administrators will have to use complex commands to execute even simple tasks. Obviously, administrators would like a facility or tool with more user-friendly features.
  4. Public folders consume Exchange resources
    Though Public folders act as repository that can be accessed by many email client users of the network, they consume valuable storage space. So, if you can find some facilities for simple sharing of data, you simply can abandon Public folders.
  5. Piling up of unwanted data in Public folders
    Public folders rarely get cleaned as nobody is sure on which information is useful and which information is not useful. Ultimately, it leads to piling up of unused and unnecessary data in Public folders.
  6. An uncertain future ahead
    Public folders may contain items that are required for many users. Calendar items, Contacts, Outlook forms, Journal entries, and even Messages are stored in them. So Microsoft may not be doing away with Public folders. Still, even experts are not sure of the future of Public Folders. Many believe that Microsoft may not provide Public folders in future versions of Exchange.
  7. Public folder to cloud migration is quite easy now
    Migrating the content of Public folders to Office 365 is quite easy now because of tools like LepideMigrator for Exchange (http://www.lepide.com/exchangemigrator/). This user-friendly tool performs data migration, and facilitates one-way or two-way migration between Exchange and Office 365 during the migration period.

Microsoft has not ended Public folders feature in MS Exchange Server. There are still a lot of reasons that prompt Exchange users to migrate their Public folder data to Office 365.

Categories
Configuring Developing Good to know SharePoint Talk

Automated deployment on SharePoint Online and SharePoint 2013 using PowerShell and CSOM

Automated deployment for SharePoint Online can be one hell of a job. Apps and sandboxed solutions are the designated methods for provisioning, but are very limited. How about PowerShell? Yes! But not the default flimsy SPO cmdlets library. No, we are using SharePoint PowerShell, a third party PowerShell API for SharePoint (Online and On-premise).

SharePoint PowerShell

SharePoint PowerShell in fact a bunch of PowerShell Modules talking to CSOM, created by a guy called Jeffrey Paarhuis 🙂  Very usefull for Office 365 and private clouds where you don’t have access to the physical server.

What can you do with it?

  • Site Collection
    • Test connection
  • Site
    • Manage subsites
    • Manage permissions
  • Lists and Document Libraries
    • Create list and document library
    • Manage fields
    • Manage list and list item permissions
    • Upload files to document library (including folders)
    • Add items to a list with CSV
    • Add and remove list items
    • File check-in and check-out
  • Master pages
    • Set system master page
    • Set custom master page
  • Features
    • Activate features
  • Web Parts
    • Add Web Parts to page
  • Users and Groups
    • Set site permissions
    • Set list permissions
    • Set document permissions
    • Create SharePoint groups
    • Add users and groups to SharePoint groups
  • Solutions
    • Upload sandboxed solutions
    • Activate sandboxed solutions

And yet more to come…

How does it work? Well, like this:

[code lang=”powershell”]

# Include SPPS
Import-Module .\spps.psm1

# Setup SPPS
Initialize-SPPS -siteURL "https://example.sharepoint.com/" -online $true -username "sitecollectionadmin@example.onmicrosoft.com" -password "password"

# Activate Publishing Site Feature
Activate-Feature -featureId "f6924d36-2fa8-4f0b-b16d-06b7250180fa" -force $false -featureDefinitionScope "Site"

#Activate Publishing Web Feature
Activate-Feature -featureId "94c94ca6-b32f-4da9-a9e3-1f3d343d7ecb" -force $false -featureDefinitionScope "Web"

# Create a subsite
Add-Subsite -title "Subsite" -webTemplate "STS#0" -description "Description…" -url "subsite" -language 1033 -useSamePermissionsAsParentSite $true

# Create document library
Add-DocumentLibrary -listTitle "Testdoclib"

# Copy testfiles to this document library
Copy-Folder "C:\example\Testdoclib" "Testdoclib" $false
[/code]

Try it yourself: example application 

And let me know what you think of it and how it can be improved!

Categories
Developing

How to create an App Part in SharePoint 2013

The App Part in SharePoint 2013 is actually a Web Part version of an App. Like Web Parts in 2010 they reside in a small frame on the page. For the old Web Part this was some rendered ASPX, for an App Part this is an HTML-page in an IFrame.

In this post I want to explain, very shortly how to create an SharePoint-hosted App Part.

Build the App Part

I assume you have a developer site collection. If you haven’t yet, you can create one by selecting the Developer Site template under the Collaboration tab when creating a new site collection. This site collection has some build-in functionality that helps you deploy Apps from Visual Studio.

Ok, start off by creating a new SharePoint App in Visual Studio.  The App will be the container for the App Part.

Create an App with Visual Studio

In this scenario we are building a SharePoint-hosted App (Part) which means we can only use client-side code. If you want to know more about the different hosting options, please read this overview on MSDN.

Select App hosting options

Visual Studio creates an App with an hello-worldish script in the App.js. This script retrieves the display name of the current user and puts it in the <p id=”message”> on the default App page Default.aspx.

[code lang=”javascript”]

‘use strict’;

var context = SP.ClientContext.get_current();
var user = context.get_web().get_currentUser();

// This code runs when the DOM is ready and creates a context object which is needed to use the SharePoint object model
$(document).ready(function () {
getUserName();
});

// This function prepares, loads, and then executes a SharePoint query to get the current users information
function getUserName() {
context.load(user);
context.executeQueryAsync(onGetUserNameSuccess, onGetUserNameFail);
}

// This function is executed if the above call is successful
// It replaces the contents of the ‘message’ element with the user name
function onGetUserNameSuccess()
$(‘#message’).text(‘Hello ‘ + user.get_title());
}

// This function is executed if the above call fails
function onGetUserNameFail(sender, args) {
alert(‘Failed to get user name. Error:’ + args.get_message());
}

[/code]

You can run this app now and see that Visual Studio deploys the app to your developer site and starts debugging it.

Plain App

Did you know that you can debug your JavaScript straight in Visual Studio without the need of browser developer tools

We now add a Client Web Part item to the project. Despite of being called a Client Web Part, this will be the App Part.

Add Client Web Part

We want the wizard to create a new page for the App Part.

Create App Part page

This creates a Client Web Part and a page.

App Part Created

We can change the properties of the App Part, like the title, by modifying the Elements.xml.

When you open the App Part ASPX page you will notice that it looks different compared to the Default.aspx. Where the Default.aspx is using the SharePoint master page, the App Part Page is an empty page with no master page whatsoever. This is because the App Part Page will be shown in an IFrame, so we need an empty page. The only code Visual Studio generates out of the box are some JavaScript references and a script that will reference the right CSS.

[code lang=”javascript”]

<script type="text/javascript" src="../Scripts/jquery-1.7.1.min.js"></script>
<script type="text/javascript" src="/_layouts/15/MicrosoftAjax.js"></script>
<script type="text/javascript" src="/_layouts/15/sp.runtime.js"></script>
<script type="text/javascript" src="/_layouts/15/sp.js"></script>

<script type="text/javascript">
‘use strict’;

// Set the style of the client web part page to be consistent with the host web.
(function () {
var hostUrl = ”;
if (document.URL.indexOf(‘?’) != -1) {
var params = document.URL.split(‘?’)[1].split(‘&’);
for (var i = 0; i < params.length; i++) {
var p = decodeURIComponent(params[i]);
if (/^SPHostUrl=/i.test(p)) {
hostUrl = p.split(‘=’)[1];
document.write(‘<link rel="stylesheet" href="’ + hostUrl + ‘/_layouts/15/defaultcss.ashx" />’);
break;
}
}
}
if (hostUrl == ”) {
document.write(‘<link rel="stylesheet" href="/_layouts/15/1033/styles/themable/corev15.css" />’);
}
})();
</script>

[/code]

Now let’s create the same hello-worldish script on this page. Therefor we need the following script reference in the header:

[code lang=”javascript”]<script type="text/javascript" src="../Scripts/App.js"></script>[/code]

And the following markup in the body:

[code lang=”html”]

<div>
<p id="message">
<!– The following content will be replaced with the user name when you run the app – see App.js –>
initializing…
</p>
</div>

[/code]

Run the App again, go to the developer site and add the App Part to the page.

Add App Part to page

Finally it would look something like this.

App Part on page

Happy coding!

Categories
Uncategorized

Send test email from SharePoint

With PowerShell you can send a test email from within SharePoint.

Run the following code with SharePoint Management Shell

[code lang=”PowerShell”]
$email = "test@test.com"
$subject = "Test subject"
$body = "Test body"

$site = New-Object Microsoft.SharePoint.SPSite "http://sharepoint"
$web = $site.OpenWeb()
[Microsoft.SharePoint.Utilities.SPUtility]::SendEmail($web,0,0,$email,$subject,$body)

// A True or False will confirm the message has been sent or not
[/code]

Categories
Uncategorized

Enabling FBA and NTLM Claims-based authentication with PowerShell

On the interwebz I couldn’t find any way to set multiple Authentication Providers on a Web Application and I need to set the Authentication Providers to NTLM ánd FBA. The examples always show one Authentication Provider. Turns out the solution is very simple:

[code gutter=”false” lang=”powershell”]
$NTLM = New-SPAuthenticationProvider -UseWindowsIntegratedAuthentication -DisableKerberos
$FBA = New-SPAuthenticationProvider -ASPNETMembershipProvider "MyMembershipProvider" -ASPNETRoleProviderName "MyRoleProvider"
$webApplication.UseClaimsAuthentication = $true
$webApplication.Update()
$webApplication.MigrateUsers($true)

Set-SPWebApplication -AuthenticationProvider $NTLM,$FBA -Identity $webApplication -Zone "Default"
[/code]

Categories
Uncategorized

Audiences in SharePoint Online

Audiences in SharePoint Online are as good as useless, because the audiences are compiled once a week. Unless you exactly know what you’re doing you can give it a try, but waiting a week to get your audiences compiled and afterwards finding out that you forgot one property is not very satisfying.

According to this forum, the compiling will be once a day in the future. So, lets wait for that.

http://community.office365.com/en-us/forums/154/p/966/2953.aspx#2953

 

Categories
Configuring Developing Good to know

Add custom filter to the SharePoint Refinement Panel

Just for my reference, or anyone else interested, a link to the perfect guide on creating a custom filter section in the refinement panel.

http://www.domorewithsearch.com/customizing-the-refinement-panel-for-sharepoint-2010-search/

Categories
Developing

Fix for List Event Receiver not working in SharePoint Online

I created a List Event Receiver for my custom List Definition and wanted to set a view list properties programmatically in the EventReceiver. It worked perfectly in SharePoint 2010 but not in SharePoint Online.

To get the list I used the SPListEventProperties.List, but this object was causing some issues in SharePoint Online. I solved it by using the SPListEventProperties.Web.Lists[listname].

Code before:

[code language=”csharp”]

SPList list = properties.List;

//enable content types
list.ContentTypesEnabled = true;

list.Update();

[/code]

Code after:

[code language=”csharp”]

SPList list = properties.List;
SPWeb web = properties.Web;

// Re-opening the list, seems to be necessary because SharePoint Online has some sort of bug or timing issue.
list = web.Lists[list.Title];

// enable content types
list.ContentTypesEnabled = true;

list.Update();

[/code]

Categories
Uncategorized

“Cannot import Web Part” fix for Social Web Parts

I’m creating a sandboxed web template for Office 365. I’m adding several web parts to a page and it’s working fine until I add Social web parts, like a Note Board or Tag Cloud. When I add one of these to a page I receive the famous “Cannot import Web Part” error upon deploying a site with this template.

The problem is that SharePoint exports the web part definition as a .webpart (v3) file. As it seems, Social Collaboration Web Parts don’t work well together with a v3 web part definition. When you change it to an old v2 (.dwp) definition it works perfectly.

So, this doesn’t work:

[sourcecode language=”xml”]

<webParts>
<webPart xmlns="http://schemas.microsoft.com/WebPart/v3">
<metaData>
SocialCommentWebPart, Microsoft.SharePoint.Portal, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" />
<importErrorMessage>Cannot import this Web Part.</importErrorMessage>
</metaData>
<data>
<properties>
<property name="Height" type="string" />
<property name="AllowZoneChange" type="bool">True</property>
<property name="AllowConnect" type="bool">True</property>
<property name="ExportMode" type="exportmode">All</property>
<property name="HelpUrl" type="string" />
<property name="Hidden" type="bool">False</property>
<property name="TitleUrl" type="string" />
<property name="WebPartPropertyDisplayItems" type="int">20</property>
Enable users to leave short, publicly-viewable notes about this page.
<property name="AllowHide" type="bool">True</property>
<property name="ChromeState" type="chromestate">Normal</property>
<property name="AllowMinimize" type="bool">True</property>
<property name="Title" type="string">Posts</property>
<property name="ChromeType" type="chrometype">TitleOnly</property>
<property name="MissingAssembly" type="string">Cannot import this Web Part.</property>
<property name="Width" type="string" />
<property name="WebPartPropertySpecifiedAddress" type="string" null="true" />
<property name="HelpMode" type="helpmode">Modeless</property>
<property name="CatalogIconImageUrl" type="string" />
<property name="AllowEdit" type="bool">True</property>
<property name="TitleIconImageUrl" type="string" />
<property name="Direction" type="direction">NotSet</property>
<property name="AllowClose" type="bool">True</property>
<property name="WebPartPropertyAllowNewComment" type="bool">True</property>
</properties>
</data>
</webPart>
</webParts>

[/sourcecode]

And this works:

[sourcecode language=”xml”]

xmlns="http://schemas.microsoft.com/WebPart/v2">
<Title>Posts</Title>
<FrameType>TitleBarOnly</FrameType>
<AllowRemove>true</AllowRemove>
<AllowMinimize>true</AllowMinimize>
<Description>Displays a list of your colleagues and their recent changes.</Description>
<Assembly>Microsoft.SharePoint.Portal, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c</Assembly>
<TypeName>Microsoft.SharePoint.Portal.WebControls.SocialCommentWebPart</TypeName>
</WebPart>

[/sourcecode]

Note the change from “http://schemas.microsoft.com/WebPart/v3” to “http://schemas.microsoft.com/WebPart/v2“. Also note the absence of the <webParts> tag, which isn’t allowed in the v2 web part definition.

In this sample I’ve taken the Note Board Web Part (SocialCommentWebPart), but you can use whatever web part you want by changing the TypeName.