Skip Ribbon Commands
Skip to main content
SharePoint

SharePoint Blog

mei 18
Delta-N SharePoint EK 2012 Poule

Speciaal voor het EK voetbal 2012 heeft Delta-N een EK poule ontwikkeld voor SharePoint. De EK poule is beschikbaar in het Nederlands en Engels en kan worden geïnstalleerd op WSS 3.0, SharePoint 2007, SharePoint Foundation en SharePoint 2010.

image

 

De EK poule is gratis verkrijgbaar via Delta-N

mei 12
SharePoint for the Internet – Part 1, Performance

The last months I have been involved in a couple SharePoint internet facing projects and decided to create a list of things to consider, specific to these type of projects. But before I start, I’d like to make a few things clear:

1. There is no definite checklist for deploying SharePoint for the Internet. Every project is different and there are no silver bullets. In fact, it is not even a real checklist (just a list of items I’d like to consider on every internet project).

2. This is my checklist based on experiences with past projects, your mileage may (and will) vary Smile 

3. There are so many options and configurations possible, it is not just about enabling/disabling features and options to achieve your goal. Every option should be investigated thoroughly and remember: ‘Just because you can, doesn’t mean you should’. 

Since there many options to consider, I divided them in three main categories and three separate blog posts:

  • Part 1: Performance (this post)
  • Part 2: Security
  • Part 3: Customization and usability

Performance

Big topic for internet facing websites. While SharePoint 2010 performs a lot better compared to previous versions, performance will (and should) always be on your list.

#1: Reduce page load

  • Remove the “Name Active X Control”. This control is used by SharePoint to show presence information (the little icon next to author names, etc.) and has no meaning on public (anonymous) web sites. You can do this through Central Administration (Web Application General Settings:

image

  • Remove the reference to the SharePoint Workspace ActiveX from the master page (present if based on the OOTB master pages).
  • Limit the use of Content Query Web Parts on landing pages. While this is a beautiful Web Part, it adds significantly to the page load time especially initially with uncached data. As a workaround you could use custom developed web parts or user controls to achieve your data query goals. This way you have good control of the rendered HTML and avoid the XSLT query processing part. But make sure you have some kind of caching in place.
  • Remove the Ribbon for anonymous users. There are a couple of ways to do this, these are the most obvious ones:
Ok? Remove or hide it using CSS. Usually not the best way to do this, because the Ribbon and support files are still downloaded by the client. They are just hidden or removed from the DOM.
Better? Wrap the Ribbon in a SPSecurityTrimmedControl. A far better option IMO, but there is a penalty because SharePoint needs a database round-trip to fetch the rights.
Best? Use different Master Pages for anonymous users and editors. You can remove the Ribbon control and support files completely from the anonymous Master Page. Also a good option if you use Content Deployment and have separate authoring and publishing farms. On the downside, you will need to find a way to use Master Pages based on what type of user requests the page.
  • Minify jQuery and other 3rd party JavaScript libraries. Use a CDN if applicable for the libraries since this facilitates caching by browser, proxy server, etc. Remember to enable local fail-over copies.

#2: Monitor Page Requests

  • Use a network monitor or traffic inspector (like Fiddler2) to monitor the HTTP request and response associated with a page request. These type of tools make optimizing page loads a whole lot easier.
  • Use the SharePoint Developer Dashboard to monitor processing and render times of individual components.

#3: Adjust IIS Dynamic Compression

  • By default SharePoint Web Servers have static and dynamic file compression enabled, but the compression level for dynamic files is set to “0”. This means that dynamic files don’t get compressed at all. You can adjust the compression level and the CPU threshold settings, for more information see Technet. It is not just about enabling this, you will have to monitor performance and Web Server CPU for tuning adjustments.

#4: Caching

SharePoint 2010 and the underlying ASP.NET offer several different methods for caching. Again no silver bullets here, and my advice: develop a caching strategy! The way you configure the different caching options totally depends on the type of content served (static versus dynamic), the audience, intended web site usage and so on. Make a note on what type of cache you configure, how you configure it and what results you expect. Once you start monitoring your site’s performance you can easily check and adjust where needed.

More info on this topic, see Technet.

  • The BLOB cache. BLOB stands for Binary Large OBject and is a disk based storage. Files initially retrieved from the SharePoint Content Database are stored on disk and served to clients on subsequent requests. You need to think about what type of files to store, where to store them (on the web server) and what client cache life time to configure (max-age).
  • The Object cache. If you are using SharePoint’s publishing feature (and you probably are on internet facing sites), you can configure this cache. The cache stores SharePoint objects (lists, page layouts, etc.) in-memory to speed up queries on them. They require the correct configuration of what is called the “Object Cache User Accounts”, again see Technet for more information.
  • Output cache. Based on ASP.NET Output Caching, but with added features (which also require the SharePoint publishing feature). Usually the least popular of the three, probably because it is a little bit harder to configure correctly. There are a couple of considerations to make, so definitely take a look at the Technet article.

Please, feel free to comment on this topic, more coming soon.

apr 17
PDF files openen in SharePoint 2010

Bij het openen van een PDF bestand vanaf SharePoint 2010 worden deze niet binnen de browser geopend. SharePoint 2010 vindt PDF bestanden niet veilig om deze binnen een browser te openen, er volgt een melding om het bestand op te slaan.

image

Dit is vrij onhandig, bestand ergens opslaan en dan openen.
SharePoint 2010 heeft een lijst met MIME types welke binnen de browser geopend kunnen worden en PDF staat daar niet tussen.

Er zijn 2 manieren om dit op te lossen:

  • Een instelling op web applicatie, Browser File Handling
  • PDF MIME type toevoegen aan lijst met MIME types die wel zijn toegestaan.

Aanpassen Browser File Handling setting voor een web applicatie.

  • Open Central Administration
  • Application Management –> Manage web applications
  • Selecteer de web applicatie en kies General Settings

    image
  • Scroll naar Browser File Handling en selecteer Permissive

    image

Nadeel van dit is dat alle MIME types worden gezien als veilig en geopend worden binnen de browser.
Het is veiliger om alleen het PDF MIME type toe te voegen aan de lijst met “veilige” MIME types.

PDF MIME type toevoegen via Powershell

Voer de volgende commands uit (wijzig <webapp url> in de url van de web applicatie):

$webapp = Get-SPWebApplication <webapp url>

$webapp.AllowedInlineDownloadedMimeTypes.Add(“application/pdf”)

$webapp.Update()

De volgende commands geven een overzicht van alle veilige MIME types:

$webapp = Get-SPWebApplication <webapp url>

$webapp.AllowedInlineDownloadedMimeTypes

Het toegevoegde PDF MIME type staat onderaan de lijst

image

apr 17
Custom SharePoint Health Analyzer rule for the ViewFormPagesLockdown feature

SharePoint 2010 has a special hidden feature that ensures anonymous users with read access cannot view list and library form pages (i.e. “Forms/AllItems.aspx”). This feature is also known as SharePoint Lockdown mode and is automatically enabled on publishing sites. Especially on internet facing SharePoint sites, this feature ensures anonymous users stay out of certain area’s of a site. Since this feature is not automatically enabled on non-publishing sites, we need to find a way to check this features state on a regular basis. We could of course create a scheduled PowerShell script for this, but I like a more solid approach for this one.

More info on the Lockdown feature on this MSDN blog (MOSS 2007, but still applicable. By Ryan Duguid)

As we all know, SharePoint 2010 includes the Health Analyzer. This component uses a bunch of rules to check the farm for predefined issues and report on any found:

1

Fortunately, the rule set is extensible and we can add our custom ones. This is not a difficult task and a good candidate for our feature check!

To start we need to create a class that inherits from either the SPHealthAnalysisRule or SPRepairableHealthAnalysisRule. From these abstract classes we need to implement some string properties “Summary”, “Explanation” and “Remedy” (for explaining the issues found) and the “Category” and “ErrorLevel” properties. The “Check()” method performs the actual analysis so must be implemented too. If you want users to be able to execute a repair right from the Central Administration interface, the SPRepairableHealthAnalysisRule includes a “Repair()” method just for that. Finally we can implement the “AutomaticExecutionParameters” property to enable automatic Timer Job execution for our rule and in this case we do.

More detailed info on this on MSDN.

1. We start with an Empty SharePoint Project, and deploy it as a Farm Solution. We add our Central Administration web as our Site Url.

2. Next we add the class that inherits from SPHealthAnalysisRule and add the necessary using statements. After implementing the abstract class our rule looks like this:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.SharePoint;
using Microsoft.SharePoint.Administration;
using Microsoft.SharePoint.Administration.Health;
namespace Blog.Examples.HealthAnalysisRule
{
     public sealed class ViewFormPagesLockDown : SPHealthAnalysisRule
    {
        public override SPHealthCategory Category
        {
            get { throw new NotImplementedException(); }
        }
        public override SPHealthCheckStatus Check()
        {
            throw new NotImplementedException();
        }
        public override SPHealthCheckErrorLevel ErrorLevel
        {
            get { throw new NotImplementedException(); }
        }
        public override string Explanation
        {
            get { throw new NotImplementedException(); }
        }
        public override string Remedy
        {
            get { throw new NotImplementedException(); }
        }
        public override string Summary
        {
            get { throw new NotImplementedException(); }
        }
    }
}
 

3. Next we add our logic to the Check() method to do the actual testing. This method uses two helper functions, both included in the downloadable solution:

  • isAnonymousEnabled: checks if the Web Application has Anonymous Access turned on.
  • isFeatureActivated: checks if the FormPagesLockDown feature is activated.

The method itself stores any failing Web Application and a counter which we can use for reporting the issues.

public override SPHealthCheckStatus Check()
{
            SPHealthCheckStatus ret = SPHealthCheckStatus.Passed;
            SPFarm farm = SPFarm.Local;
            foreach (SPService service in farm.Services)
            {
                if (service is SPWebService)
                {
                    SPWebService webService = (SPWebService)service;
                    foreach (SPWebApplication webApp in webService.WebApplications)
                    {
                        if (isAnonymousEnabled(webApp))
                        {
                            foreach (SPSite site in webApp.Sites)
                            {
                                try
                                {
                                    if (!isFeatureActivated(site, new Guid(FEATUREGUID)))
                                    {
                                        //Anonymous Access is enabled on the Web Application, but the ViewFormsLockDown feature was not found.
                                        this.failingWebApplications.Add(webApp.Name, +1);
                                    }
                                }
                                finally
                                {
                                    if (site != null)
                                    {
                                        site.Dispose();
                                    }
                                }
                            }
                        }
                    }
                }
            }
            if (this.failingWebApplications.Count == 0)
            {
                ret = SPHealthCheckStatus.Passed;
            }
            else
            {
                ret = SPHealthCheckStatus.Failed;
            }
            return ret;
 }
 

4. Finally implement the property “SPHealthAnalysisRuleAutomaticExecutionParameters” to enable automatic Timer Job schedules.

public override SPHealthAnalysisRuleAutomaticExecutionParameters AutomaticExecutionParameters
{
            get
            {
                SPHealthAnalysisRuleAutomaticExecutionParameters retval = new SPHealthAnalysisRuleAutomaticExecutionParameters();
                retval.Schedule = SPHealthCheckSchedule.Daily;
                retval.Scope = SPHealthCheckScope.All;
                retval.ServiceType = typeof(SPTimerService);
                retval.RepairAutomatically = false;
                return retval;
            }
 }    
 

5. We now could build and deploy, but we would have to register the custom Health Analyzer rules through PowerShell. This process can be automated through SharePoint’s feature framework.

 public override void FeatureInstalled(SPFeatureReceiverProperties properties)
 {
            try
            {
                Assembly currentAssembly = Assembly.GetExecutingAssembly();
                IDictionary<Type, Exception> exceptions = SPHealthAnalyzer.RegisterRules(currentAssembly);
            }
            catch (Exception ex)
            {
                throw new Exception("There was an error registering the Health Analysis rules: " + ex.Message);
            }
}
 

If we compile and deploy, we can see our rule in action.

2

image

If you want the rule to report any errors, make sure you enable anonymous access on a Web Application and disable the (hidden) feature. Of course we should use PowerShell for this:

Disable-SPFeature -Identity ViewFormPagesLockDown -Url http://public.demo.loc

Download the complete solution here.

aug 25
Changing SharePoint 2010 Search Ranking Model

SharePoint 2010 Enterprise Search uses ranking models to determine how data is weighed and results are ranked. Out of the box SharePoint 2010 provides nine different models, from which two are used by default. You also have the option to create your own if this is required. To see which models are registered with your Search Service Application, you can use the following PowerShell Command:

[sourcecode language='powershell'  padlinenumbers='true']
 Get-SPEnterpriseSearchRankingModel -SearchApplication "Search
 Service Application"
[/sourcecode]

1

The default Core Results Web Part uses the MainResultsDefaultRankingModel and the People Results Web Part uses the MainPeopleModel. To try the different models, you can just append the search results querystring with &rm=<guid>

So …/Pages/peopleresults.aspx?k=john&s=People&rm=0bba4d7d-4f2c-4086-975a-8f9d2b6c6d53 would return people results using the NameModel.

If you want to permanently alter the used ranking model, you have to adjust the Results Web Part. Follow these steps to modify the normal search:

  1. Export the Core Results Web Part.
  2. Add or modify the following property, for instance:
    <property name="DefaultRankingModelID" type="string">0bba4d7d-4f2c-4086-975a-8f9d2b6c6d53</property>.
  3. Import and re-add the web part.

For people search, this unfortunately does not work very well. The People Core Results Web Part will reset your DefaultRankingModelID back to use the MainPeopleModel once you upload your web part. Just add a (hidden) Core Results Web Part to your page and configure the property that way.

jul 19
Speed up SharePoint 2010 development

SharePoint Development tends to be a wee bit more time consuming compared to “standard” ASP.NET development. Although Microsoft really helped us a lot by providing seriously improved integration with Visual Studio 2010, building, packaging, deploying and debugging can still be annoyingly slow.

Here are a couple of things you could do to speed things up a bit.

1. Fast hardware

Of course the most important part. Be sure to have a lot of RAM in your development machine, at least 4 GB. With the 64-bit OS requirement for SharePoint 2010 we can address more than 3 GB so make sure it is available. Even current generation laptops can handle 8 GB of RAM, no excuses anymore (apart from budget that is).

Because you probably run all required software on one machine, fast disks are equally important. This component improves the overall experience, but MSSQL Server benefits the most. If you are running virtuals, you can go for fast external disks using eSata (or maybe USB 3.0). If you are more like me (and don’t like the external disk hassle) be sure to examine the disk specs when shopping for new hardware.

2. The right OS

I tried running Windows 7 Ultimate with SharePoint 2010 installed locally. Yes it works, but it is still a desktop OS. And you really can’t run things like domain controllers and stuff like that locally. If you really want things to go fast, you boot a regular server OS, say Windows Server 2008 R2. It handles server software far better than any desktop OS. And if you can, just install all needed components on one server (i.e. MSSQL Server, SharePoint 2010, Visual Studio, Office, Domain Controller, DNS, etc.). And Windows 7 VHD boot makes dual booting a breeze!

If you do need more than one server, think about installing Windows Server 2008 R2 with the Hyper-V role. And run your servers on top of that! You will probably need at least 8GB (host + 2 guests), but will give you ultimate flexibility.

3. Tweak your OS and server software

Same old story:

  • Don’t run unneeded services or components. No, you don’t need Adobe Auto Updater or the Windows Media Player Online Subscription blah blah. Check the Windows Services and registry “run” keys.
  • If you run MSSQL Server (and you probably do), be sure to maximize its memory to a value you consider adequate. This way, it won’t hog up your machine. Also if you have more than one disk, store the “tempdb” on a different disk than the content or configuration database. Other “production” performance tweaks also apply of course.
  • Regarding SharePoint IIS configuration, I normally run most parts on the same Application Pool. This saves valuable memory, but makes recycling take a bit longer. If you run many Web Applications but only develop in one, dedicate one AppPool to your development application and share the rest.
  • Keep your content databases lean. There is normally no need to develop against a 50+ GB database. Just use a default empty one or with limited content. You can of course switch later on if you need to test your solution.

4. Be smart

When deploying and debugging SharePoint solutions, Application Pool recycles are a pain! Be smart when laying out your Visual Studio projects and decide which parts must be farm solutions and which parts sandbox solutions. Remember: farm solutions require a IIS recycle where as sandbox solutions do not (see earlier post about Sandbox solutions). You can always merge them later when heading towards production state.

If you are developing loads of Web Parts or User Controls (used by Visual Web Parts), there is another thing you could do. Since most of them are plain ASP.NET components, you can stick them on a simple ASPX page and develop them using IIS. Especially handy during the early stages and you can add them to your SharePoint project when they need a SharePoint environment.

5. Time savers

You probably already have the “CKS: Development Tools Edition” installed. If not, please do. They also contain several time savers regarding deployment, like Quick Deploy, Copy Assemblies and Copy Files. There is even a feature that warms up your site after a IIS recycle!

You probably have other tricks up your sleeve, but I thought I’d share mine.

Pingback on July 19, 2011 by yuriburger from http://allthingssharepoint.wordpress.com/2011/07/19/speed-up-sharepoint-2010-development/

jun 15
Visual Studio 2010: Sandbox Deployment Errors

So you created a nice Sandbox SharePoint solution and need to deploy it. You entered the correct Site URL and hit deploy. Unfortunately the output shows  a failed deployment step:

image

Couple of deployment errors Visual Studio might throw at you at this stage:

Error occurred in deployment step 'Activate Features': Cannot start service SPUserCodeV4 on computer <name>.

Check if the Windows Service is not disabled: “SharePoint 2010 User Code Host”. Better yet, set it to “Automatic” on your development machine.
Error occurred in deployment step 'Activate Features': This feature cannot be activated at this time. The contents of the feature's solution requires the Solution Sandbox service to be running. Your development environment should have at least one server running the “Microsoft SharePoint Foundation Sandboxed Code Service “. Check in Central Administration/ Services on Server.
Error occurred in deployment step 'Add Solution': Sandboxed code execution request failed. This could have a couple of reasons, but the one I encounter the most is lack of rights. I normally enable “god-mode” on my dev machines (see below).
Error occurred in deployment step 'Activate Features': Attempted to perform an unauthorized operation. If you are running in “god-mode” this shouldn’t happen. Just make sure you are Site Collection Administrator.

This list is by no means complete and I will extend it as I encounter other issues, hopefully not too many :).

Running in “God-mode”

Important: Not recommended in production environments. Since you are deploying with Visual Studio, this is obviously not the case.

To enable easy access on your development machine, make sure the following is true

  • Disable User Account Control (in Windows 2008 R2 this means lowering the setting to “Never notify”.

image

  • Microsoft Visual Studio runs as Administrator (see title bar).

image

  • You are a member of the local Administrators group
  • You are a member of the local WSS_ADMIN_WPG group
  • You are database owner (dbo) of both content databases and the SharePoint_Config database
  • You are Farm Administrator
  • You are Site Collection Administrator
feb 22
Custom SharePoint Designer Activity

SharePoint 2010 comes with several powerful pre-defined workflows and activities. But what if the out of the box workflow activities don’t (fully) meet your requirements? You could of course go fully Windows Workflow Foundation and develop the complete workflow in Visual Studio 2010. Another option is to develop a custom Activity and make it available to SharePoint Designer. This way the end user can tune and modify the workflow without the need to bother the developer.

Things we need:
• Visual Studio 2010
• SharePoint 2010 (any edition will work)
• SharePoint Designer 2010

Create the activity

1. Create a new C# Workflow Activity Library Project
2. Add references and “using” statements to the following assemblies:

using System.Workflow.ComponentModel;
using System.Workflow.Activities;
using System.ComponentModel;
using Microsoft.SharePoint;

Make sure your project targets Framework 3.5 and everything should be available right from the “Add Reference” dialog.

3. Modify Activity1.cs which will contain our activity

Of course we now need some properties for our workflow activity. In order to access the properties from our custom activity, we need some form of special declaration. This way we can ensure SharePoint Designer hooks up all the needed information. This declaration is done with the help of what is called “Dependency Properties”. They start off with a standard .Net property with get and set methods and then get registered as a “DependencyProperty”. You do this by appending “Property” to the name (this is important) and declaring it like this:

public static DependencyProperty SiteUrlProperty = DependencyProperty.Register("SiteUrl",typeof(string), typeof(CreateSite), new PropertyMetadata(""));

I want my activity to create a site, so I need the following properties at least:
• SiteUrl: url of the root site where the new site will be created
• SiteName: name of the new site
• SiteTemplate: template to be used for the new site

After we setup the properties, we need to override the Execute method:

protected override ActivityExecutionStatus Execute(ActivityExecutionContext executionContext)
{
  Create();
  return ActivityExecutionStatus.Closed;
}

4. Sign the assembly with a strong named key.

Create the deployment

Because we are targeting SharePoint Designer, it is now the time to work on our deployment.
1. Add a new Empty SharePoint Project to our solution and make it a Farm Solution.
2. Add the following mapped SharePoint folder: {SharePointRoot}\Template\1033\Workflow
3. Create the Actions xml file

<WorkflowInfo>
  <Actions Sequential="then" Parallel="and">
    <Action Name="Create Site" ClassName="CustomActivityLibrary.CustomActivityCreateSite" Assembly="CustomActivityLibrary, Version=1.0.0.0, Culture=neutral, PublicKeyToken=1b2a70b987e8b655" AppliesTo="all" Category="Custom SPD Activity">
      <RuleDesigner Sentence="Site Name %1 in root site %2 using template %3.">
        <FieldBind Field="SiteName" Text="Site Name" DesignerType="TextArea" Id="1"/>
        <FieldBind Field="SiteUrl" Text="Url of root site" Id="2" DesignerType="TextArea"/>
        <FieldBind Field="SiteTemplate" Text="Name of the template" Id="3" DesignerType="TextArea"/>
      </RuleDesigner>
      <Parameters>
        <Parameter Name="SiteName" Type="System.String, mscorlib" Direction="In" />
        <Parameter Name="SiteUrl" Type="System.String, mscorlib" Direction="In" />
        <Parameter Name="SiteTemplate" Type="System.String, mscorlib" Direction="In" />
      </Parameters>
    </Action>
  </Actions>
</WorkflowInfo>

4. Add the project output from the ActivityLibrary as an additional assembly to the Package.

spd3

5. Add the assembly as an authorized type to the web.config:

<authorizedType Assembly="CustomActivityLibrary, Version=1.0.0.0, Culture=neutral, PublicKeyToken=1b2a70b987e8b655" Namespace="CustomActivityLibrary" TypeName="*" Authorized="True" />

And voila, we can now make use of our own custom activity:

spd2

Deployment on a production machine, is of course somewhat different. You need the following components:
1. Your workflow activity library (the assembly)
2. The workflow .actions file (place it in the Template\1033\workflow folder)
3. The SafeControl entry in the web.config
4. The authorizedType entry in the web.config

 

Original article can be found at: http://allthingssharepoint.wordpress.com/2011/02/21/custom-sharepoint-designer-activity/

sep 22
€ 100,- korting op de entreeprijs voor SharePoint Connections 2010 Autum

Wil je nog naar SharePoint Connections?
Gebruik onderstaande kortingscode en ontvang 100,- korting.

SharePoint Connections 2010 Autumn is op 28 en 29 september 2010 in het World Forum in Den Haag.

Klik hier voor het volledige programma

Registration URL: http://sharepoint.msregistration.com/reg

code: DC7JF

image

sep 21
Microsoft SharePoint 2010, is it a true Document Management System?
A post I did on SharePoint 2010 and DMS: http://allthingssharepoint.spaces.live.com/
1 - 10Next

 ‭(Hidden)‬ Admin Links