Category Archives: SharePoint 2013 Administration

Getting the default document icon using Office 365 SharePoint REST API

If you assumed that SharePoint’s REST API would return the document icon for your document by default, you’d be wrong. If you don’t assume that, then you’re smarter than me. Come to find out there is a separate API to call to get the icon.

The REST API to get the icon is

https://%5Btenant%5D.sharepoint.com/_api/web/maptoicon(filename='filename.pdf', progid='', size='0')

The size options, 1 or 0, return the image for 32×32 or 16×16, respectively. If you’re listing your documents in a list view similar to SharePoint, you’ll want to use 0.

Here’s a little snippet using it with jQuery to get your icons back:

//fileName would be any filename, like This is my file.pdf or Document.docx
var url = _spPageContextInfo.webAbsoluteUrl + "/_api/web/maptoicon(filename='" + fileName + "',progid='',size=0)";
$.getJSON(url)
 .then((data) => {
 var icon = $("<img src='" + _spPageContextInfo.webAbsoluteUrl + "/_layouts/15/images/" + data.value + "'/>")
 //now throw your icon object into wherever you want to use it
 })

Til next time, Happy SharePointing!

Advertisements

Vertical Promoted Links in SharePoint 2013

I had the pleasure of helping out Veronique via SPYam. It’s a great use case for the promoted links list!

Views from Veronique

SharePoint 2013 has nice little tiles called Promoted Links to link to stuff all over your sites.  However, they all display horizontally when you add them to your page. Silly Microsoft for not providing us the option to list them horizontally or vertically in the first place – but thank you SharePoint community for providing the work-around, (and specifically in this case, David Lozzi)! :)  I love copy / paste code!!  Learn how to do this from our discussion on Yammer – thanks for your help David!

promoted links vertical and horizontal

================================================================

Post Blog Update : So it seems not everyone is on Yammer.  Instructions and code copied and pasted below for your convenience. :)

<style type=”text/css”>
.ms-promlink-body {width: 170px }
.ms-promlink-header {display: none}
</style>

Drop it into the Edit Source bit of the Content Editor Web Part on the page to make it work.  If the web part is too wide, insert it into…

View original post 104 more words

Installing SharePoint 2013 Foundation

Come along with me on a small adventure into the world of free SharePoint. Yes, free! SharePoint Foundation 2013 is technically free (well, included in your existing Windows licenses) and can do a whole lot for you without needing to spend significant amounts of money on Server editions. I am going to walk through a mini-series around SharePoint Foundation: installing (this post), what features it contains (and does not), how it can fulfill some use cases and finally a wrap up discussing if Foundation is a viable solution for companies both large and small.

Downloading SharePoint Foundation

Finding SharePoint Foundation was not as easy as one would expect. Going to www.sharepoint.com, and clicking Try or Buy didn’t render a link. I clicked Try Now under SharePoint Server 2013. Then off to the right under Related Downloads is a link for SharePoint Foundation 2013. Wait, that doesn’t have SP1 which is required for Windows Server 2012 (but SP1 has been retracted, hasn’t it?), so I searched some more and found it. Lucky for you, you can download it from: http://www.microsoft.com/en-us/download/details.aspx?id=42039. If you’re running Windows Server 2008, you can download it without SP1: http://www.microsoft.com/en-us/download/details.aspx?id=35488. Looks like Microsoft doesn’t necessarily want to show off this free version is readily available.

Requirements

Requirements for Foundation are similar to the Server versions. Check out the hardware and software requirements here.

My Setup

I am installing it in VMWare, with 8GB RAM and 2 cores. It’ll be slow but that’s okay for now. I already have Windows 2012 R2 Standard installed, and I have SQL Server 2012 Standard with SP1 installed on another VM. SQL has been configured with a named instance SPF2013A for this specific instance of SharePoint.

I need SQL too?

SharePoint runs on Microsoft SQL, period. Sorry, you can’t run on MySql or any other variation out there. If you don’t have access to SQL server, you can either install SharePoint in a single server instance which includes SQL for you, or better yet, download and install SQL Express (free). Note there are limitations, but if you’re doing a quick POC or trying out SharePoint, SQL Express will probably be fine. I recommend installing SQL separately as it’ll allow you to expand on your new SharePoint farm in the future. Even if you don’t have plans to expand this farm, install SQL separately, as your production farm will be using this model. I do not cover installing SQL, as there are many flavors and options.

Service Accounts

SharePoint utilizes Active Directory for permissions and such, starting at installation. You cannot install it on a server without AD. You shouldn’t install it on a server that is the AD domain server, though it will probably work, it’s not supported by Microsoft.

Create the following AD accounts for your SharePoint install. You can go crazy and use a service account for every service in SharePoint, allowing for an incredible amount of security separation (and maintenance) but being realistic, I prefer to use the following. Each account has to be a domain account, not a domain admin, just a domain user.

  • Farm admin account, i.e. spfarm.
    • This account will be the installation account, and SharePoint will setup the permissions for the rest of the accounts.
    • Needs local administrative rights to your SharePoint server, excluding SQL.
    • Account must be setup with dbcreator and securityadmin roles in SQL.
  • Application service account, i.e. appsvc. This account will be used to run your service applications in SharePoint.
  • Web service account, i.e. websvc. This account will be used to run your web sites services and application pools.

Prerequisites

Prior to installing SharePoint on your server, you’ll need to setup your server to handle a web site. Add the Application Server and Web Server (IIS) roles. Also include Application Server Role Services Web Server (IIS) Support.

Check your SQL Server’s properties, specifically the Max Degree of Parallelism of a value of 1. Check out http://www.sharepointpitstop.com/2013/04/max-degree-of-parallelism-error.html for more details, I ran into this issue myself ;).

Installing SharePoint Foundation

Now that you’ve found and downloaded SharePoint Foundation, got SQL setup, let’s install SharePoint! First, log in with your  spfarm account, and then run the install file you downloaded, and you’ll get the lovely blue splash screen.

SharePoint Foundation 2013 Splash Screen

Click Install software prerequisites, under the Install section. This installs all the stuff SharePoint needs to run.

SharePoint Prerequisite Installer

Just accept defaults and walk through this wizard. This wizard will probably require your server to restart. It may need to reboot a couple of times depending on how many updates it has to do.

Log back in and rerun the installer. Back at the blue screen, press Install SharePoint Foundation. Most of the installation will be pretty basic: accept the terms, press continue. For Server Type, select Complete and press Install Now.

server type

When done, you can go ahead and press Close.

install done

So far so good? The SharePoint bits, the binaries and files, are installed! Now onto the fun part and configuring SharePoint!

The SharePoint Products Configuration Wizard will appear next. Click Next then Yes to the warning. On the next page, select Create a new server farm.

create

 

On the next screen, enter your details for the SQL server, and use your spfarm account for its credentials. I have the \SPF2013A because I installed SQL with another instance, you can probably leave yours as the server name.

sql

Specify a passphrase. Important! This passphrase will be needed if you want to add another server to your farm in the future. Keep it safe!

passphrase

 

On the next screen, you can leave it as default, or specify a port number. If you decide to specify your own port, do not specify any of the standard web ports like 80, 443, 8080, etc. This should be a unique port number as central administration is the core of SharePoint, all configuration, permissions and such occurs here.

 

central administration port

Click Next a couple more times and the configuration will run. It may take a while depending on hardware and what not. Let it run. It will error if there’s a problem, otherwise, no news is good news.

successful

Success! Click Finish and Central Administration will open.

Configuring SharePoint

After a successful installation, Central Administration should open. If for some reason it doesn’t, you can open it from the Programs menu.

When Central Administration opens first, it’ll ask if you want to help make SharePoint better. Do as you wish, it’s your conscience.

So you have an option to here to use a wizard to configure SharePoint.

wizard

I prefer not to use the wizard, I’m a hands on kind of guy. The wizard is ok, and if you’re going to do a quick and dirty proof of concept, I guess you could do that. I will, however, carry us through the entire process, I’m going to press Cancel. That will bring us out to Central Administration:

central administration

Before we make any new sites, we have to continue to configuring SharePoint to get ready. Click Security in the left quick launch, and then click Configure managed accounts.

register account

 

Add your service accounts. In my case, I added the 2. What’s nice is if you fat finger the password, it will prompt you. This is nice since that will not cause issues down the road.

 

added svc accountsOnce added, click Application Management, then click Manage Service Applications.

service application

If you click new in the top ribbon, you’ll see a few options. We’re going to add each of these. Start with the App Management Service. Fill out the following in the dialog:

  • Name. I go with something clear, like “App Management Service”
  • Database. This should default to your SQL server, and you can leave it as is.
  • Failover Server. If you have one, you can specify it, otherwise continue on.
  • Application Pool. We do want to create a new application pool.
    • Application pool name, specific Application Services.
    • For the security account, select Configurable and select the appsvc account from the picker.
  • Create App Management Service Proxy. Keep the Create option checked.
  • Click OK.

Next up, create a new Secure Store Service.

Why did I skip the Business Data Connectivity Service? Because we don’t need it. This service allows SharePoint to connect to external data systems, like another SQL database. If you want to use it, go for it, but for most POCs, we don’t need it.

Ok, back to the Secure Store Service.

  • Name: Secure Store Service.
  • Database. Again, this should default, let’s move along.
  • Failover Server. Ya, again, move along.
  • Application Pool. This time, let’s select an existing application pool, specifically the one we made before, Application Services.
  • Enable Audit. Keep that checked.
  • Click OK.

Outgoing Email

Couple more small things. Click on System Settings, then Configure outgoing e-mail settings. Specify your outgoing email server. You can simply put your Exchange server here. You’ll have to allow relaying from the SharePoint server IP address. SharePoint does not authenticate with the outgoing email server.

If you want, you can validate the outgoing email by setting up a relay on the SharePoint server. This works well with Exchange or any cloud based email service. Check out my other post on Sending SharePoint emails through the cloud.

Services

Click System Settings then Manage Services on Server.

services on server

Now we have to turn a bunch of stuff on. Turn on the following:

  • App Management Service.
  • Microsoft SharePoint Foundation Subscription Settings Service.
  • Secure Store Service.

Create your first site

Now that SharePoint is configured and ready to go, let’s create a site. The site itself will be what your users access. Click Application Management then Manage web applications.

web app

Brief overview of SharePoint’s architecture

The SharePoint farm is what we have now. It’s SharePoint, installed and configured. It can be installed across multiple servers. Note we didn’t have to install SharePoint on SQL. SQL simply stores the databases, however SQL is still considered part of the farm.

Web applications are the top level of data collections. As you’ll see, Central Administration has a web app. A web app is a collection of Site Collections.

Site collections are a collection of sites, and can contain one to many sites.

Sites are the interfaces your users go to to access SharePoint. Sites contain lists, libraries and all the user data.

Create your web application

Click New in the ribbon. Fill out the page as follows:

  • IIS Web Site. SharePoint will create the following IIS web site on your farm. Keep port 80, specify a host header. For quick and dirty, you can specify your server’s name, in my case spf2013a. If you want something more meaningful, specify a valid name which has been setup in your DNS.
  • Security Configuration. You can leave this as is.
  • Claims Authentication Types. Leave it.
  • Sign In Page URL. Move on.
  • Public URL. Ditto.
  • Application Pool. We’re going to create a new one, keeping the default name is fine. Under the security account, select your websvc.
  • Database Name and Authentication. You can leave the database name as is, however I generally append the site name to the database name so I know what database goes to which site.
  • Failover Server. Ya, you know.
  • Service Application Connections. Move along.
  • Customer Experience Improvement Program. Again, up to you.
  • Click OK.

Create your site collection

When the web application finishes, the confirmation window will have a link to create a site collection, click that.

If you were so excited to have setup your web app that you closed that confirmation window. Click Application Management, then Create site collections.

In the Create Site Collection dialog, specify the following:

  • Title and Description. The title is the name of the site, what your users will see. This can be changed at any point later. Not as stressful as naming your kid, but close. You can leave description blank.
  • Web Site Address. Keep the / selection.
  • Template Selection. Select a Team Site. This is a basic site, a great starting point.
  • Primary Site Collection Administrator. Select the smartest person you know, yourself! Specify your user name in here so you can easily get into the new site.
  • Secondary Site Collection Administration. Select the other administrator of the site. You can specify more later on.
  • Quota Template. Leave with No Quota.
  • Click OK.

You’re ready to go!

new site

That’s it! You should be all set to go! We didn’t have to create a site, as a site collection always has a default root site within it.

If you try to hit the site from the server console, you may have an issue, check out this post for an easy fix.

Quick tips:

  • Click the cog, or the gear, or the little circle looking thing in the top right, then go to Site Settings. This is all the behind the scenese including permissions, Look and Feel, search settings and a whole lot more. Familiarize yourself with what’s here.
  • Click the cog, then Add an app. This is how you add new lists and libraries.
  • Click the cog, then Site Contents. This shows all content on the current site. This is also where you can create new sub sites, scroll down and you’ll see a link for new subsite.

Til next time, Happy SharePointing!

Looking for the next part? Sorry I’m a  slacker! Leave comments below and I’ll finish it off. 

 

A Non-Developer’s Intro to the Developer Toolbar: Other Cool Stuff

This is part four of my mini-series, part one covered element inspectionpart two covers scripting and part three covered performance.

In this, my final post, I will cover some of the other neat things the developer toolbar does for us. I may get a little deeper than a non-developers point of view. All of the items below live in the menu of the toolbar

menu

Link Report

Click the View menu, then Link report.

Link Report

This neat little report tells you all of the links on the current page, and how they’re accessed.

Image Report

Click the Images menu, then image report.

Image Report

This report includes all of the images on the page, along with loads of data about the image, including sizes.

Cache

Pronounced cash, but has nothing to do with money. Cache is a local temporary storage location for assets like images and scripts, and allows your computer to use the local version instead of the server version, which is faster. However, cache is also a frequent headache dealing with web pages. Hopefully your developers and support teams never said “you need to clear your cache”. If they do, you can do this from this menu. Select Clear browser cache… from the Cache menu.

Resize your Browser

You can resize your browser to some of the standard dimensions. Click the Tools menu, then click Resize and select your size. Why would you want to do this? One, you can see what the page looks like for users with a lower resolution than yours. Two, basically an extension of one, is if you’re dealing with responsive web design, you can see what your tablet would see when the browser is reduced to the tablet size.

Ruler

Click Tools menu, then Show Ruler.

rulerA neat little tool to size up anything on the page. Not sure what a non-developer would use this for, but hey, it’s cool anyway.

Don’t be afraid to explore

I think that should do it! The developer toolbar, though named and targeted to developers, has some nice resources for non-developers. Don’t be afraid to explore and try out some other stuff. Have fun and harass your developers, they’ll love it.

There’s more than meets the eye: Differences between SharePoint’s Oslo and Seattle master pages

If you’ve been looking at the neat new masterpages with SharePoint 2013, and playing around with changing them, you can quite easily see a difference between the two options: Oslo and Seattle. Seattle is what we’re used to with SharePoint 2010: left nav and a top nav. Oslo moves the left nav to the top, and removes the top nav all together. Oslo also provides more room for your content by widening the area by moving the left nav.

SharePoint's Oslo Masterpage

Oslo Masterpage Layout

SharePoint's Seattle Masterpage

Seattle Masterpage Layout

But what is really different, technically speaking? I compared the two pages and found a little more:

Comparing Oslo to Seattle Master Pages

  • Oslo uses a different CSS, obviously, oslo.css instead of corev15.css. Also, the CSS link has EnableCssTheming set to true, whereas Seattle doens’t state anything.
  • Oslo has several accessibility and animation links wrapped with a SPSecurityTrimmedControl, configured to hide the contents from the search crawler. Seattle just has the links listed, no security trimming.
  • Oslo has a AuthenticatedUserDiv tag wrapping almost all of the content on the page. This control “Renders a DIV element which has different styles based on whether the current user is authenticated or anonymous” (from MSDN article). This control is configured with an authenticated style set to a CSS class. So when an authenticated user accesses the site, it uses a CSS class, when it’s anonymous, no class is specified at all.
  • Oslo has several other areas and controls wrapped with SPSecurityTrimmedControl configured to restrict to authenticated users only.
  • Oslo has a couple of small areas where CSS class names differ.
  • There’s the obvious changes with the navigation and header, and previously noted.
  • The PlaceHolderTopNavBar content place holder is thrown at the bottom of the page, and is set to be hidden. So that’s where that went.

Seeing there are a lot of security trimming around authenticated vs anonymous, I decided to test that out to see what it looks like.

First, let’s see what Seattle looks like anonymously:

SharePoint Seattle Masterpage in Anonymous

Seattle Master Page as Anonymous

Interesting, the web parts are intelligent enough to know anonymous users can’t “get started” and the newsfeed is gone. Also, some of the ribbon items change. Nothing else too significant.

Next up, Oslo:

SharePoint Seattle Masterpage in Anonymous

Oslo Master Page as Anonymous

Whoa, that’s a lot more now isn’t it? We lost the ribbon completely, including the SharePoint blue bar at the top. It feels naked.

I compared the HTML output of the two sets of pages as well.

  • Seattle didn’t differ much, minor items, but nothing too specific to anonymous vs authenticated.
  • Oslo, huge differences, entire sections are missing. Those security trimmed sections I mentioned before, poof, gone.

It almost feels like Oslo was designed with anonymous access in mind, as in Microsoft wanted us to use Oslo for public facing sites, as it took care of so much for you already. ;)

Thanks to Sane Amit for asking this question on SharePoint.StackExchange.com, always looking for new post ideas ;)