menu
Tech blog, musings & updates from Intelligent Decisioning
Want to work with Intelligent Decisioning? That’s great, let’s talk

Category Archives: SharePoint

A User’s Guide to Content Types

Share socially -

Since SharePoint was first introduced in 2001, content types have been a key feature in the way it is used to managed documents and files. A content type combines important information such as metadata (a summary of the content), how it should behave, it’s workflow and other settings to be applied to a category of items or documents.

As an example, we could define a content type “Invoice”; this could then be applied to all invoice documents within a SharePoint library. Within this content type, we could have the following attributes:

  • The template for the document
  • Columns representing items of metadata – date, client company, billing address, value…
  • A behaviour requirement to automatically display the Document Information Panel when a new file of this content type is created to input the required metadata
  • An Information Management policy detailing the retention policy

SharePoint ships with a number of useful default content types. Many of these contain similar properties to file types that you would store on your own computer, such as the “digital assets” content types – audio, video and image. These content types contain information about the title, publisher, length (for audio and video) and date of creation. There are also document and list content types for basic pages, forms, blog posts and announcements.

Whilst the default content types are sufficient for many SharePoint users, it may be necessary for your organisation to create custom content types. This is useful for company reports, sales proposals, case studies and other specialised content. This is most easily achieved by editing an existing content type from one of the large collection of pre-defined site content types in the Web Designer Gallery. It is also possible to create a custom content type from scratch in the Web Designer Gallery by setting a parent content type, for example, “Digital Asset”.

Content types are defined for a site and will apply within the site and its subsites. However, if you want a particular content type to be used across your organisation you may want to publish it on multiple sites or site collections. Using a Managed Metadata service in SharePoint allows you to publish content type to specified sites, known as “subscriber sites”. For more on content type publishing, read Microsoft’s guide here.

3 Ways Businesses can ready themselves for flexible working

Share socially -

Flexible work arrangements have long been a feature in the workplace, but as more collaboration technologies move to the cloud, it’s becoming increasingly common for workers to work from home. A recent report by the TUC shows that the number of employees choosing to ditch the office continues to soar, with a 20% increase in home-workers in the last decade. According to Phil Flaxton, Chief Executive of WorkWiseUK and the organiser of National Work from Home Day:

“Increasing mobility and technology is shifting the acceptance or need for traditional office based, 9-5 work patterns, to be replaced by more home-based, flexible ways and periods of work”

Not only has this shift increased the options available to workers, but according to data published by Gallop, the added flexibility has dramatically impacted employee engagement, with the most productive workers reported to be spending just one day a week in the office.


Source: Gallup State of the American Workplace Report 2013

So it’s clear that the ability to spend time working outside of the office environment is not only desirable for employees, it brings numerous benefits for organisations. But companies need to consider their readiness to adopt such working practices. With this in mind, how can employers adapt their work practices to suit the growing trend of flexibility?

  1. Integration
    Within every organisation, there are a variety of ways departments communicate with each other. Whether it’s with instant messaging, teleconferencing, email or carrier pigeon, when you throw long distance in the mix, it can be overwhelming. Despite the number of tools claiming to be able to cover all the niche requirements of collaboration between teams, they usually end up just adding one more source of information to the already overcrowded collection. Instead of trying to cover all bases with one solution, it’s becoming more desirable and realistic to use tools that integrate into a single platform. Microsoft’s offerings in productivity software are ever-growing, and their ability to work with each other is unrivalled. For applications with less cross-compatibility, apps such as Flow allow processes to be linked together; for example, you can use Flow to get a push notification when you receive an email from your boss.
  2. Centralise Information
    As the amount of data storage required by businesses increases exponentially, it’s more important than ever to have files stored in one central location, accessible from anywhere. It’s no longer enough to hold information on a physical hard drive – it’s expensive, insecure and it relies on the user being in the same location as the storage device.  For maximum productivity, your employees need to be able to find the information they need in one place, without laborious searching of archives and trawling through dead links. A digital workplace allows information storing, sharing and collaborative working in a centralised location, and can also act as a training platform with access to internal resources and how-to guides.
  3. Security
    With the ability to access sensitive data from any location, companies have reduced control over the security measures in place when staff work from home. Risks vary from the loss of files that have not been backed up, the theft of passwords or the computer itself being compromised. For these reasons, it’s essential that there is a protocol in place that establishes the rules for working from home or outside the office. Using cloud-based platforms – such as Microsoft Office 365 – allows users to access Office applications, email, calendars and file sharing via a secure connection, with no data being stored on the employee’s own computer.

With the trend of working from home looking set to last, it’s vital that businesses invest in the technology that allows their workers to enjoy the benefits of flexible working. For more information on strategies to improve your businesses ability to allow working from home, check out our webinar on the top ten benefits an Intranet can bring to your business.

Start and Stop SharePoint Search Crawls with PowerShell

Share socially -

Quite often you may wish to start a SharePoint Search content crawl on demand, without waiting for the next scheduled crawl to start. You may still be running SharePoint Server 2010, or not able (or willing) to run a continuous crawl of your content.

To make your job that little bit quicker when it comes to starting a Search Crawl, you can easily start either Incremental or Full Crawls via PowerShell.

Simply retrieve the Content Source that you want to crawl, then invoke the appropriate method.

$cs = Get-SPEnterpriseSearchCrawlContentSource -SearchApplication "Search Service Application" -Identity "Local SharePoint Sites"

# This method starts a full crawl
$cs.StartFullCrawl()

# This method starts an incremental crawl
$cs.StartIncrementalCrawl()

# Do this to stop any currently running crawls
$cs.StopCrawl()

# This property returns the status of your crawl
$cs.CrawlStatus

 

Obviously, change the SearchApplication parameter to match the name of your search application, and the “Identity” parameter to match the name of the specific Content Source you want to crawl.

You can wrap up all of the PowerShell lines that you need to kick off the crawl you want into a text file with the extension of “.ps1” and invoke from a SharePoint Administration Shell prompt whenever you need to!

 

Enable Stack Traces to find C# Disposal Issues

Share socially -

If you look through your SharePoint ULS logs during the development of server-side code and you spot the warning:

An SPRequest object was not disposed before the end of this thread.  To avoid wasting system resources, dispose of this object or its parent (such as an SPSite or SPWeb) as soon as you are done using it.

Then there’s a chance you haven’t followed Microsoft’s best practices around disposal of unmanaged resources in the C# SharePoint Server Side Object Model.

Going solely by the information in ULS doesn’t immediately show you where your SPSite or SPWeb was instantiated.  As the warning states, you need to enable SPReqest Allocation Callstacks to see full stack traces of your code to see where you need to fix SPRequest issues.

The following PowerShell snippet will do just that:

$cs = [Microsoft.SharePoint.Administration.SPWebService]::ContentService

$cs.CollectSPRequestAllocationCallStacks = $true
$cs.Update()

 

Of course, as you develop you can use static analysis tools such as SPCAF from Rencore to make sure you’re following the best practice for object disposal as you code.

Please note that this is only beneficial if you develop C# code using the SharePoint Server Side Object Model that runs on the SharePoint servers. If you are developing using any of the remote APIs (such as JavaScript Object Model, Client Object Model or REST) then this setting has no real benefit.

You may also notice that sometimes you will see this error when performing valid API tasks where you do not necessarily create the SPWeb or SPSite objects yourself. I’ve noticed this in particular with the Taxonomy API. I found these to be acceptable exceptions when analysing the ULS log for these warnings, as the code that raises the warning is deep within assemblies that are maintained by Microsoft, and the warnings may disappear over time with service pack releases.

How to create an exportable Script Editor web part in Office 365

Share socially -

The Script Editor web part is one of my favourite tools in my SharePoint development kit as it enables developers and designers to be able to inject HTML, JavaScript and CSS into any SharePoint page without having to open SharePoint Designer.

Great, but… there is a drawback, and a quite annoying one at that… you cannot export a default Script Editor web part.

No way, no export!
No way, no export!

Why is that annoying? Exporting web parts is the easiest way to replicate the functionality configured inside them in SharePoint. You can take your exported web part, store it in your Site Collection Web Part Gallery and reuse it using the Add Web Part button on the SharePoint Ribbon.

However, there is a very simple update you can make to change this and create your own version of the Script Editor that you can export by default.

Add a Script Editor to a web part zone and click the Edit Web Part command from the web part menu. This will open the Web Part Properties pane.

On the properties pane, expand the Advanced section. You will see that there is a field to set the Export Mode of the web part, change this to Export All. This will enable the Export command on the web part menu, which will allow you to save the web part locally to your desktop.

advancedproperties
Export All the things!

After saving the web part locally, rename the file to “ExportableMSScriptEditor.webpart”. You can save this back to you SharePoint site for it be reused by uploading it to your Web Part Gallery.

Go to your site and click the Settings cog to access the Site Settings page, from here you can access the Web Part Gallery under the Web Designer Galleries heading.

Upload your new web part file into the Web Part Gallery using the Ribbon, on the Files tab click the Upload Document button and select the file when promoted by the “Add a web part” dialog box.

Once uploaded, you will be asked to confirm or alter the file name, title, description and group of the web part.

Once that is complete and your new web part is showing in the Web Part Gallery, you can now add this to your page via the Ribbon.

Edit the page, got to the Ribbon and select the Insert tab, click the Web Part button to open the Web Part Picker to find and select your web part to then add to the page.

View the web part in the Web Part Picker
View the web part in the Web Part Picker
It lives!!
It lives!!

You will now be able to Export the web part from the web part menu.

Now that you can use your own version of the Script Editor web part you can create web part functionality and easily export them for further reuse or simply for a quick backup, just in case someone changes and breaks it.

Here is an example of a web part that used the Exportable Script Editor web part as a starting point to display a simple list of links.

usefullinks

 

 

 

I hope you’ve found this little trick helpful and thank you for reading 😀