Sunday, April 28, 2013

Compare SharePoint 2013 editions

A quick reference for comparing the several editions
(Office 365 plans, standalone plans & on-premise)

Tuesday, April 23, 2013

Thursday, April 18, 2013

Crawling publishing image fields

When you crawl an image field in SharePoint 2010, you will notice that its crawled property does not contain any data. You have several options to work around this issue, but my favourite option is by using a custom META tag. The SharePoint crawler will provide every META tag as a crawled property. These crawl properties can be found below the Categories > Web section in the Managed Properties module of the search service application. These properties are available with the same name of the custom tags, in uppercase.

 
   <meta name=’myImageFieldMetaTag’ content=’<SharePointWebControls:FieldValue  FieldName="myImageField" runat="server" id="myImageFieldId"/>’ id="myImageFieldMetaTagId" />



What about SharePoint 2013?

I haven't tried it yet, but it seems like it's supported in the new version.
All site columns that contain values will automatically become managed properties when they're crawled. A publishing image field is one of them and will be crawled with the following name syntax:

Crawled property name: ows_q_IMGE_SiteColumnName
Managed property name: SiteColumnNameOWSIMGE

I'm not sure yet, if I like the auto generation. Those names are not that userfriendly, but yes... it doesn't matter in this case.

Reference: Automatically created managed properties in SharePoint Server 2013

Friday, April 12, 2013

No sitecollections available in content database

After a content database restore we coudn't access our sitecollection anymore. We verifed the content database status and number of sitecollections. In our case, the current number of sitecollections was equal to 0.


We fixed this by running a couple of Powershell commands...

1. Retrieve content database GUID
Get-SPContentDatabase
2. Synchronizes the content database with the configuration database of the farm with respect to what site collections actually exist in the content database
$cdb = get-spcontentdatabase -Identity [insert guid of contentdatabase here]
$cdb.RefreshSitesInConfigurationDatabase()
Reference: MSDN

Monday, April 8, 2013

Display specific managed metadata in refinement panel - SharePoint 2010

Another blogpost about SharePoint 2010? Yes I know, it's time to move on... but hey, not every customer has already the new version of SharePoint. This information is not really unique on the web, but it's more a reminder for myself ;)

The refinement panel webpart's FilterCategoriesDefinition property contains the XML that specifies the filter categories. If you want to modify the categories, don't forget to clear the "Use Default Configuration" checkbox.

Display all managed metadata fields

Display only specific managed metadata fields
Place the following XSL stylesheet into the XSL property of the refinement panel to view the raw XML, returned by the search...

  
  
   
   
   <xsl:copy-of select="*"/> 
  
 

The raw XML outputs the different filtercategories. Each filtercategory has a specific ID with prefix 'Metadata_xxxxx'. Copy the last part of the ID (i.e. 'xxxxx') and use this value to set the title of the category within the filter category definition section:

Thursday, March 21, 2013

SharePoint 2013 meets a new Global Assembly Cache (GAC)

As a SharePoint developer you need to muddle in the Globale Assembly Cache (GAC) from time to time. Be aware that SharePoint 2013 now uses a different CLR (v4.0).This means that the GAC directory is moved from c:\windows\assembly to c:\windows\microsoft.net\assembly.

If you don't find your assembly in the GAC - think twice!

Sunday, October 28, 2012

Hide list column headers of a list view webpart

Hide list column headers of all list view webparts on the page

  1. Add a Content Editor WebPart (CEWP) to the page
  2. Use the following CSS:
    
    

Hide column headers of a specific list view webpart


The method, described in the following blogpost will definitely work (find listview by title), but there is a downside with this method. What if the end user renames the list? Our solution will break.

I think it's safer to find a listview by URL. The URL is fixed and cannot be changed from the UI (only with SharePoint Designer).
  1. Add a Content Editor WebPart (CEWP) to the page
  2. Use the following JQuery script: !! Don't forget to change the URL to the URL of your list
  3.  
    
    

Saturday, October 20, 2012

SharePoint 2013 - Short Introduction to Animation Engine

Already noticed the "fade in" effect on the page while browsing in SharePoint 2013?
No? Open a standard Teamsite and focus the main content...

Before
After
 

So, how does this work?

Some site templates uses the Minimal Download Strategy (MDS) framework. This framework consists of several components working together to only download the changes between the different pages. The main component is the start.aspx application page (as I said, there are more components to make this work). This page is responsible for loading pages from the site using the MDS. I don't want to write an in-depth article about MDS here...our main focus is the animation effect, remember? :) The codebehind of this page is defined in the following class: Microsoft.SharePoint.ApplicationPages.MDSStartPage.

The startpage will, among other things, register the start.js script. This script contains a javascript object, called the AsyncDeltaManager. This object will handle the delta requests/responses. When the AsyncDeltaManager retrieves a delta, he will call (at the end) the BeginTransitionAnimation() javascript function. This function does the preparation for the animation effect, ONLY if the MDS animation is enabled. At the end, the animation effect will be started in the EndTransitionAnimation() function. This is where the magic happens. He will call the SPAnimationUtility.BasicAnimator.FadeIn(content, null, null); command!

As far as I know, the fade effect is only used for the following placeholders:
  • PagetitleInTitleArea
  • Main


Can we disable the animation effect?

Yes, we can! (HTML5) web storage is used to enable/disable the animation effect. Below you'll find a couple of commands you can use...
SPAnimation.Settings.EnableAnimation(); //enable animation
SPAnimation.Settings.DisableAnimation();//disable animation
SPAnimation.Settings.DisableSessionAnimation();//disable animation only for this session
ToggleAnimationStatus();//toggle animation
SPAnimation.Settings.IsAnimationEnabled(); //check whether animation is enabled

Monday, October 15, 2012

Display animated spinner while loading modal dialog

The following javascript function SP.UI.ModalDialog.showModalDialog(options); is a way to display a modal dialog with specified dialog options. When you assign a value to the URL property of the dialog options, an IFRAME tag is rendered pointing to the appropriate URL.

ShowDialog example
var options = {
    title: "My Dialog Title",
    width: 400,
    height: 600,
    url: "/_layouts/DialogPage.aspx" };

SP.UI.ModalDialog.showModalDialog(options);
To display an animated spinner, you can set a background-image for the iframe with some CSS.

CSS
iframe
{
    background-image: url("../images/animatedspinner.gif");        
    background-repeat: no-repeat;     
    background-position: 50% 50%; 
}

Result

Wednesday, August 1, 2012

Extract details from a WebException

try
{
    //Do something
}
catch (WebException ex)
{
    using (var stream = ex.Response.GetResponseStream())
    using (var reader = new StreamReader(stream))
    {
        string errormessage = reader.ReadToEnd();
    }
}
catch (Exception ex)
{
    //Do something
}

Monday, July 30, 2012

Easily embed Youtube videos, Javascript, styles and other markup into a SharePoint 2013 page with the Script Editor WebPart

Instructions below are executed within a Team Site template:
  1. Select the ‘Edit’ icon in the top right corner of the page to edit the page

    EmbedCode0
  2. Select ‘Page’ in the ribbon, click ‘Embed Code

    EmbedCode
  3. Enter some script, styles, embed code,… in the editor box

    Javascript example
    EmbedCode2

    Youtube example
    EmbedCode3

    EmbedCode4

    Notice the preview of the embedded video
  4. Click ‘Insert
  5. Save the page with ‘Save & Close’ in the top right corner.
Some remarks:
  • After clicking ‘Insert’, a Script Editor WebPart will be automatically inserted into the page - only if you’re using embedded code.

    ScriptEditorWebpart
  • Default Chrome type is ‘None’
  • The Script Editor WebPart is also available as webpart under ‘Media and Content’

    EmbedCode5
  • You can still use the Content Editor Webpart to achieve the same results. The main difference between the two is that the Content Editor WebPart  is more focused to  enter rich text content, while the new Script Editor WebPart is more focused to insert HTML snippets and scripts.

Saturday, June 23, 2012

SharePoint Sucks – And Here’s Why...

What would you do when you see this message?

unexpected-error

A) Stay calm, try to copy the correlation ID, notice that you can’t copy it and still stay calm, write it down on a piece of paper and track it in the ULS logs

B) Open your browser, go to a search engine and type “SharePoint sucks” to let off steam

If you have chosen option B, you’ll probably encounter the funny blog series of Bjørn Furuknap. Give it a read, they are a bit outdated but there’s still a lot of truth in it.
Ow, btw, I didn’t search after “SharePoint sucks” – it was a colleague who mentioned the blog series. He has probably chosen for option B. Ok, to be honest, there are days that I hate SharePoint too. I have some sort of love/hate relationship with it.

Let me end this post with a funny quote of Bjørn Furuknap.
Over the past couple of weeks, I’ve said quite a lot of things about SharePoint that may lead you to think I hate SharePoint. I don’t. Quite the contrary, I love SharePoint. Yeah, it sucks, but so does my wife, and I’ve married her twice.

Sunday, June 17, 2012

Quick Tip: Approval Workflow - Due date for all tasks

Within the association form of the approval workflow you are able to set the “Due Date for All tasks”. This setting specifies the date by which all tasks are due.

What if you want tasks to become due on a specific time on a specific day? In the user interface of the association form you are not able to specify a time value.

DueDateForAllTasks

Although it is nowhere documented, it is possible.

For example, if you want to terminate all tasks on the 18th of June at 13h30 you can set the following value in the textbox:
2012-06-18T13:30:00

Use the following structure to set a time value:
yyyy-mm-ddThh:mm:ss

I know, it’s not really user friendly, but it works. You can probably use SharePoint Designer to tweak the association form to implement some extra logic.

One of the best references online about approval workflows in SharePoint 2010: All about approval workflows

Wednesday, February 29, 2012

Export Farm Solution Package with PowerShell

Follow the steps below to export a farm solution package…

1. Open a text editor – such as Notepad.
2. Paste the following code snippet:

$farm = Get-SPFarm
$file = $farm.Solutions.Item("MySolutionPackage.wsp").SolutionFile
$file.SaveAs("c:\MySolutionPackage.wsp")

3. Replace the highlighted text above with the name of your solution package.
4. Save the file - give the file a name and save it with the extension ps1 (eg. extract.ps1) and place the file on the C:\ drive.
5. Open the SharePoint 2010 Management Shell
6. Navigate to the location of the script and execute it.
7. The solution package will be available on the C:\ drive


Update: If you want to download all the solutions at once you can use the following script:
$dirName = "C:\Solutions"
foreach ($solution in Get-SPSolution)
{
$filename = $Solution.SolutionFile.Name
$solution.SolutionFile.SaveAs("$dirName\$filename")
}

Thursday, February 16, 2012

Error: The form cannot be rendered. This may be due to a misconfiguration of the Microsoft SharePoint Server State Service...

This error can be encountered while viewing an InfoPath form in the browser. In most cases, the problem can be solved by reading through the following blogpost.

In my case, the state service was enabled and the service application was correctly associated with the webapplication. I solved this by deleting the 'corrupt' state service database, creating a new one and attaching the new database to the farm - all these steps can be done with some Powershell commands.


Friday, September 9, 2011

Reserved Querystring Parameters In SharePoint

This is probably the 100th post on the net about...
"Be careful when naming querystring parameters in your SharePoint applications"

But you can't say it enough. They cause trouble!
For more info read this.

Wednesday, September 7, 2011

Could not access the Search administration database. A generic error occurred while trying to access the database to obtain the schema version info.

Deleting the following registry key - did the trick for me:

“HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Shared Tools\Web Server Extensions\14.0\WSS\Services\Microsoft.SharePoint.Search.Administration.SPSearchService”

In fact, it's just one of the things that need to be verified.
Read this post for more info.

Saturday, June 11, 2011

Default location picture upload in RTE

If you want to insert a picture in the rich text editor directly from your computer, you will notice that the RTEUploadDialog pops up in which you can browse for a file and select a location.

!cid_image001_png@01CC25D2!cid_image002_png@01CC25D2

Unfortunately, you can’t set the default location.

Workaround

Option 1: Because the “Upload to” dropdown list is filled up alphabetically, you can rename the library you want (eg. let it start with an underscore).

Option 2: (Not supported by MS) You can write some javascript to select another default value for the dropdown list. Insert your javascript into the RTEUploadDialog application page (/_layouts/RteUploadDialog.aspx).

As far as I know, this page is not only used for uploading images, so you probably have to take into account the querystring parameter ‘Dialog’ (/_layouts/RteUploadDialog.aspx?LCID=1033&Dialog=UploadImage).

Sunday, April 10, 2011

Reporting Services: RSViewerPage

The main file used for displaying reports is the RSViewerPage.aspx. This page contains a breadcrumb and a webpart called ReportViewerWebPart. This webpart renders a toolbar, the report and a parameters pane.

Hide buttons from the toolbar

I saw a couple of articles of people who disable some toolbar buttons by diving into the ConfigurationInfo table of the Reporting Services Database. This method will work for a few buttons, but not for all of them. I discovered that you don’t need to adjust that database table at all. You can use the ToolBarItemsDisplayMode property of the ReportViewer WebPart. This property allows you to hide/show specific parts of the ReportViewer’s toolbar. Be aware, this property is an enumeration field.

For example: ToolBarItemsDisplayMode=’223’ will hide:

  • Open with Report Builder (Action Menu)
  • Subscribe (Action Menu)
  • Atom icon

Before:

Toolbar

After:

Toolbar2

Why 223? You have to make the sum of the values of the parts you want to include in the toolbar. The values are shown in the reference table below:

ToolBarItemsDisplayMode

You can set the property by adding the property in the RSViewerPage.aspx like

<RSWP:ReportViewerWebPart id="m_sqlRsWebPart" runat="server" SuppressWebPartChrome="true" Height="100%" ToolBarItemsDisplayMode="223" Width="100%" />

OR

You can pass the property as a querystring rv:ToolBarItemsDisplayMode=”223”

Related posts: