SharePoint Use Cases

04 Aug, 2010

Add all site collections as PerformancePoint trusted locations via PowerShell

Posted by: Toni Frankola In: SharePoint|SharePoint 2010  Bookmark and Share

In case you have been playing with SharePoint 2010 IW Demo VM you might bumped into this error:

The query could not complete because the following items are not in a PerformancePoint trusted location…

The solution for this problem is simple, you just need to add all PerformancePoint locations to the trusted list in PerformancePoint service application. I usually use IW Demo machine to do demos and sometimes during presentation a customer might request you to present something (like PerformancePoint) that was not on your demo agenda.

To make sure the errors like the one above do not appear in front of your customer I wrote a simple scripte that will automatically add all existing site collection as trusted PerformancePoint locations. Please note that this is for demo purposes only and you should not execute this in production enviroment before consulting your system adminstrator.

Here is the script:

# check to ensure Microsoft.SharePoint.PowerShell is loaded
$snapin = Get-PSSnapin | Where-Object {$_.Name -eq 'Microsoft.SharePoint.Powershell'}
if ($snapin -eq $null) {
  Write-Host "Loading SharePoint Powershell Snapin"
  Add-PSSnapin "Microsoft.SharePoint.Powershell"
}

$ppApp = Get-SPPerformancePointServiceApplication

$ppApp | Get-SPPerformancePointServiceApplicationTrustedLocation | Where {$_.RepositoryLocationType -eq "SiteCollection"}| Remove-SPPerformancePointServiceApplicationTrustedLocation

Get-SPSite -Limit All | Where{$_.Url -notlike "*/personal/*" -and $_.Url -notlike "*/my"} | ForEach-Object {
	$ppApp | New-SPPerformancePointServiceApplicationTrustedLocation -Url $_.Url -TrustedLocationType Content -Type SiteCollection
	$ppApp | New-SPPerformancePointServiceApplicationTrustedLocation -Url $_.Url -TrustedLocationType DataSource -Type SiteCollection
}

$ppApp | Get-SPPerformancePointServiceApplicationTrustedLocation

Few notes:

  • This script first deletes all trusted locations of SiteCollection type
  • It adds all site collections in your farm excluding those that have my or personal as part of their URL (MySites)

A customer emailed me this morning saying:

Hey Toni, we want to upgrade Windows SharePoint Services 3.0 to the latest SharePoint. Can you send me a quote and we are ready to go…

Before doing anything else, you need to ask your customer a few simple questions just to make sure you understand the situation (customer installed WSS 3.0 alone) so that you can make the right assessment. Please note: these are just general questions, in a full-scoped project you need to ask many more…

Questions

  • 1) Have you installed Windows SharePoint Services 3.0 Service Pack 2?
    If you are not sure go to Central Admin > Operations > Services and SharePoint Version will be displayed.

    • Why am I asking this question? You can only upgrade to SharePoint 2010 (any edition) if you have installed Windows SharePoint Services 3.0 / SharePoint 2007 Service Pack 2. You customer might not have this information so you will probably get only version number (e.g. 12.0.0.6219). You can „convert“ the version to actual service pack via this table.
  • 2) Are you planning to do in-place upgrade or there is another (new) server ready for SharePoint 2010?
    (in this case we are not doing Core Infrastructure so there will be different company installing OS)

    • Why am I asking this question? In case customer is planning to do in-place upgrade you need to make sure operating system is supported and bunch of other things like downtime, some other system that might be problem etc…
  • 3) Are you aware of SharePoint 2010 operating system requirements? You need Windows 2008, 64bit architecture and 8GB of RAM.
    • Why am I asking this question? Customers and other non-SharePoint Microsoft partners do not know about SharePoint requirements and they do not care. That’s okey! You need to double check these 3 things: Windows 2008, 64bit architecture and RAM amount! You can check the full list of SharePoint 2010 requirements here. Depending on company size they might need more than one server, check TechNet for more details…
  • 4) Can you install Windows 2008 R2?
    • Why am I asking this question? Although both Release1 (Windows 2008) and Release2 (Windows 2008 R2) are from same product family, R2 comes with number of improvements and it is much easier to install and maintain SharePoint installation on top of R2. If possible ask customer/partner to install R2. People are not always aware that R2 exists. In case you will be using Windows 2008 make sure it is fully patched.
  • 5) Did you install any 3rd party solutions, or some custom code?
    • Why am I asking this question? Well, if you are not doing in-place upgrade you will have to install these again and you need to make sure you have proper WSP packages to install.
  • 6) Did you use any of the Fabulous 40 templates?
    • Why am I asking this question? When upgrading these templates you also need to make sure these are installed. AFAIK there are no Fab40 version for 2010 at this time, and some of these might not work. I already had problems with Bug Tracking template, and chances are some other templates might not work correctly at this time…
  • 7) Do you use any non-English language packs?
    • Why am I asking this question? Well Microsoft didn’t release all the language packs for SharePoint 2010 at this time (e.g. Croatian language pack is still not available, and probably a number of “smaller language” packs are yet to be released). Make sure you have all the language packs you need.
  • 8 )  Are you using SQL Server or Windows Internal Database as backend?
    • Why am I asking this question? SharePoint 2010 now ships with SQL Express 2008(?) as default database (embedded) backend. SQL 2008 Express has 4GB per database limit, SQL Express 2008 R2 has 10GB per database limit while Windows Internal database (shipped as embedded with SharePoint 2007) didn’t have this limit. Your customer might have e.g. 100GB of data in a Windows internal database and you will not be able to upgrade database this big to SQL 2008/2010 Express.
  • 9) Can we use SQL Server?
    • Why am I asking this question? I always prefer to install on top of full-blown SQL (Check previous question too). Express is nice but some management tools like Maintenance plans, backup scheduling and some other stuff are only available in full SQL so always install on top of SQL if possible. If you plan to use SQL Server 2005 or SQL Server 2008 (not R1) make sure it is fully patched before installing.
  • 10) Do you have SharePoint licenses?
    • Why am I asking this question? You need to double check this! They might say they have but then they cannot find the proper key. Make sure they have the key ready before you start installing… You should also always use their image, not the one available on the Microsoft download site. Some Microsoft keys like VLK (Volume Licensing Keys) for some products cannot be activated on top of incompatible images. Always use keys provided by your customer and their installation images!

I hope this will help you run your upgrade engagement. For full list of SharePoint 2010 upgrade resources check this post by Joel.

07 Jul, 2010

Updated – Search AutoComplete for SharePoint 2010 Central Administration

Posted by: Toni Frankola In: SharePoint|SharePoint 2010  Bookmark and Share

We have just updated release of our Search AutoComplete for SharePoint 2010 Central Administration web part.

The solution has been tested and updated for SharePoint 2010 RTM release and we also fixed deployment script for Farm solutions. You can download for FREE with full source code. Click here to send your feedback.

Original Post:

SharePoint 2010 introduced a new and improved Central Administration which looks awesome. However when I am teaching about SharePoint or presenting it to customers I need a quick and easy way to find an option in Central Admin (yeah I know, I am lazy :) ). So I decided to build a „search as you type“ web part for Central Admin.

It is based on JQuery, and JQueryUI as the previous web part I blogged about. It was inspired by Office Search Commands project.

It comes in two flavors:

  • SandBox Solution (it does not list commands for Service Application administration)
  • Farm Solution (it lists all commands available including multiple Service Applications if available)

You can download for FREE with full source code.

07 Jul, 2010

Retract SharePoint solution from Central Admin with PowerShell

Posted by: Toni Frankola In: SharePoint|SharePoint 2010  Bookmark and Share

I deployed a custom made solution to the SharePoint 2010 Central Administration application. However when I tried to remove the solution and failed from both PowerShell and GUI. The solution remained in the Deployed state. After examining the log files I figured out that SharePoint timer iterates all the web applications except central admin.

Here is the PowerShell script to remove a solution that was deployed to Central Admin Application.

# check to ensure Microsoft.SharePoint.PowerShell is loaded
<pre>$snapin = Get-PSSnapin | Where-Object {$_.Name -eq 'Microsoft.SharePoint.Powershell'}
if ($snapin -eq $null) {
  Write-Host "Loading SharePoint Powershell Snapin"
  Add-PSSnapin "Microsoft.SharePoint.Powershell"
}

$centralAdmin = Get-SPWebApplication -includecentraladministration | where {$_.DisplayName -eq "SharePoint Central Administration v4"} | select Url
$solutionName = Read-Host "Please enter your solution name (e.g. MySolution.wsp)"

Uninstall-SPSolution -Identity $solutionName -WebApplication $centralAdmin.Url -Confirm:$false

Hope this helps!

04 Jul, 2010

Compile and package Sandboxed and Farm solutions using the same code base

Posted by: Toni Frankola In: SharePoint 2010  Bookmark and Share

SharePoint Sandboxed solutions allow site administrators to deploy custom web parts without physical (console) access to the SharePoint server. Sandboxed solutions are easily uploaded via Solutions gallery.

Sometimes, while developing a solution, you want to know if your code is running sandboxed or as a normal farm solution. In order to check if the code is running sandboxed or not, you can use the approaches suggested to me by Wictor Wilen and Chris O’Brien.

I recently installed Visual Studio 2010 SharePoint Power Tools (I highly recommended you to install these too). This pack introduces a new ability to check if a sandboxed solution contains any code which will not be able to run sandboxed on a SharePoint farm. (Check this article for more details on SharePoint sandboxed solutions restrictions).

The ability to check if you are using any prohibited namespaces or functions at compilation time ensures that you do not deploy a sandboxed solution that will not work as advertised. However, in case you want to package both Sandboxed and Farm solutions from the same (or similar) code base, there is a simple trick, and this article explains how to it. The typical scenario for something like this is when you have a web part that works as Sandboxed solution but in case your code is deployed as Farm solution you want to use some additional functionalities that are not available while running in a Sandbox. In my case I created Search AutoComplete for SharePoint 2010 Central Administration Web Part, by default it works as Sandboxed Solution but it can only list Service Apps links if deployed as Farm solution.

Here is what you need to do in order to compile both solutions from the same code base:

  • Create two new build configurations for your project Debug-Sandbox and Release-Sandbox
  • Define new Conditional Compilation Symbols: DebugSandbox for Debug-Sandbox configuration and ReleaseSandbox for Release-Sandbox configuration
  • Open your project file (csproj or vbproj extension) in Notepad
  • Locate Project Group tags and make sure you have 4 project groups and SandboxedSolution node in each Project Group node. This node determines if solution is going to be complied as sandboxed or farm solution. Set the value to TRUE for your sandboxed build configurations and FALSE for Debug and Release. (As shown on picture below)

To separate your code preprocessor directive needs to be used, as in this example:

protected override void Render(HtmlTextWriter writer)
        {

#if DebugSandbox || ReleaseSandbox
            //This code block will compile if sandboxed build configuration (Debug-SandBox or Release-Sandbox) is chosen
           writer.Write("Hello world, I am a sandboxed web part!<br/>");
           writer.Write("This web part is sandboxed solution and cannot retrieve total number of sandboxed solutions.");
#else
            //This code block will compile if non sandboxed build configuration is chosen
           writer.Write("Hello world, I am NOT a sandboxed web part!<br/>");

            SPUserSolutionCollection solutions = SPContext.Current.Site.Solutions;
            writer.Write(string.Format("There is a total of <b>{0}</b> sandboxed solutions installed in this site collection!<br/><br/>", solutions.Count));

            if (solutions.Count > 0)
            {
                writer.Write("These are the installed solutions:<br/><ul>");
                foreach (SPUserSolution solution in solutions)
                {
                    writer.Write(string.Format("<li>{0}</li>", solution.Name));
                }
                writer.Write("</ul>");
            }
#endif

            base.Render(writer);

        }

When you compile this example as a farm solution it will display the list of installed sandboxed solutions. When compiled as sandboxed solutions it will display a message text only.

Conclusion

This technique might come handy when you have two web parts that have only few differences and you do not want to maintain a separate code base just for that. The down side of this approach is that you cannot have both build configurations deployed to the same site collection at the same time because both share the same feature id.

31 May, 2010

Remove all Service Applications from SharePoint 2010 farm with PowerShell

Posted by: Toni Frankola In: SharePoint|SharePoint 2010  Bookmark and Share

Well, sometimes things do not go as planned and you need to undo some things you did in SharePoint testing environment or for a client.

As I am currently working on a script to install Service Applications I had a need to remove 10-20 service application from my testing farm automatically.

Here is the script that can do that; it will automatically remove all service applications along with associated data.

Click here to download the script.

cls

if((Get-PSSnapin | Where {$_.Name -eq "Microsoft.SharePoint.PowerShell"}) -eq $null) {
Add-PSSnapin Microsoft.SharePoint.PowerShell;
}

$seviceApps = Get-SPServiceApplication | Where {$_.TypeName -ne "Security Token Service Application" -and $_.TypeName -ne "Application Discovery and Load Balancer Service Application"}
if($seviceApps -ne $null) {
$seviceApps | ForEach-Object {Remove-SPServiceApplication $_.Id -removedata -confirm:$false}
}

$serviceAppProxies = Get-SpServiceApplicationProxy | Where {$_.TypeName -ne "Application Discovery and Load Balancer Service Application Proxy"}
if($serviceAppProxies -ne $null) {
$serviceAppProxies | ForEach-Object {Remove-SPServiceApplicationProxy $_.Id -removedata -confirm:$false}
}

23 May, 2010

My slides from SharePoint conference Peru

Posted by: Toni Frankola In: SharePoint  Bookmark and Share

Yes, I spent an amazing week in Peru attending and speaking at SharePoint Conference Peru. After the conference we visited Cusco and Machu Picchu and we all had amazing time. Conference was an amazing success, with more than 170 attending, all sessions were packed and people were very enthusiastic about SharePoint 2010 release.

SharePoint Conference Peru Team on Machu Picchu

I presented delivered to sessions for the conference and here are my slides:

12 Apr, 2010

Search AutoComplete for SharePoint 2010 Central Administration

Posted by: Toni Frankola In: SharePoint|SharePoint 2010  Bookmark and Share

Posts in the "Introduction to SharePoint 2010 SandBox Solutions" series

SharePoint 2010 introduced a new and improved Central Administration which looks awesome. However when I am teaching about SharePoint or presenting it to customers I need a quick and easy way to find an option in Central Admin (yeah I know, I am lazy :) ). So I decided to build a „search as you type“ web part for Central Admin.

It is based on JQuery, and JQueryUI as the previous web part I blogged about. It was inspired by Office Search Commands project.

It comes in two flavors:

  • SandBox Solution (it does not list commands for Service Application administration)
  • Farm Solution (it lists all commands available including multiple Service Applications if available)

You can download for FREE with full source code.

06 Apr, 2010

Search AutoComplete for SharePoint 2010 lists

Posted by: Toni Frankola In: SharePoint|SharePoint 2010  Bookmark and Share

Posts in the "Introduction to SharePoint 2010 SandBox Solutions" series

In my previous post I explained how to create an interactive search for SharePoint 2007 lists. It’s time to take things to the next level, so let me introduce Search AutoComplete for SharePoint 2010 list (download). It gives you the same functionality (search as you type) as the previous version but it is created as SandBox solution (check my post Introduction to SharePoint 2010 SandBox Solutions for Site Collection Owners for details).

This solution is free and can be downloaded as WSP or with full source code. The solution uses following technologies: JQuery, JQueryUI and SharePoint 2010 Client OM.

Installation

Search AutoComplete for SharePoint Lists is a SandBox solution and can be deployed to any farm environment. If Sandbox solutions are disallowed for your site collection, contact your farm administrator.

  • Download and unpack solution package
  • Go to your Site Collection > Site Actions > Site Settings
  • Browse Galleries > Solutions
  • Go to Solutions ribbon tab and click Upload Solution
  • Upload the WSP package you downloaded and Activate it
  • Open a SharePoint web page and Insert a web part
    (from Custom > Search AutoComplete for Lists)

Configuration

Web part needs to be configured to properly search a list on your web site.

  • Choose Edit Web Part from the web part context menu
    Edit Web Part
  • Expand Search section in the Web Part Toolpane
    Web Part Properties
  • Type the name list name in the List Name field (e.g. Contacts)
  • Type the names of list columns you want to display in Display Fields Field (e.g. [Title])
    • Surround column names with square brackets (e.g. “[FirstName] [Title], [WorkPhone”) <- internal name for LastName is Title :)
    • Use internal field names

The benefit of a SandBox solution

Solution like this one could be deployed via Content Editor web part, but in such case users will have to manually customize a script to work on their site. When deployed as Sandbox solution, its properties will be exposed as web part properties, and users do not need to modify the code. Further more you can use .NET to run additional stuff on the server side.

What’s next?

In next posts in this series:

  • How to deploy Search AutoComplete for SharePoint lists without Sandbox
  • How to enforce Sandbox Solution web part properties
  • How to use Search AutoComplete for Central Admin commands

Stay tuned!

30 Mar, 2010

Introduction to SharePoint 2010 SandBox Solutions for Site Collection Owners

Posted by: Toni Frankola In: SharePoint|SharePoint 2010  Bookmark and Share

Posts in the "Introduction to SharePoint 2010 SandBox Solutions" series

If you have been reading about exciting new features of SharePoint 2010 you probably heard about something called SandBox Solutions. In this post I will try to explain what SandBox Solutions are and how you, as Site Collection Owner / End User / Non Developer type, can benefit from these solutions.

In a nutshell, SandBoxed solutions allow you to:

  • Deploy custom code you have developed or downloaded from the Internet
  • Such custom code you deploy cannot jeopardize the stability of your farm
  • Solutions are being deployed via web interface
  • If you are running SharePoint in a hosted environment you will be deploy SandBoxed solutions there as well

SandBox Solutions support the following SharePoint item types:

  • List definitions
  • List instances
  • Content Types/Fields
  • Navigation
  • Web Parts derived from WebPart
  • Event receivers
  • Custom Workflow Actions
  • Workflows

For full list check SharePoint Dev Wiki.

Hello World Web Part

So let’s try to deploy our first custom SandBoxed solution web part. I have developed one for you. It comes with two simple web parts.

To deploy it:

  • Download the solution package to your computer
  • Open your SharePoint 2010 site collection
  • Go to Site Actions > Site Settings > Galleries > Solutions
  • Click Upload Solution from Solutions ribbon
  • Once uploaded make sure you have Activated the solution

To insert this custom web part go to a web part page, choose Edit, then Insert a web part. Web parts you just deployed will be in the Custom group.

Insert the Hello World web part to your page. It will render as something like this:

Once deployed, you might ask: Well Toni, this is nice, but I could create this using only JavaScript/JQuery.

Yes you could do that, but in next few articles I will show you some stuff you cannot do. The other important benefit is the ability to download/purchase 3rd party web parts and deploy these without any risk.

Very bad Web Part

So let’s do something you shouldn’t do at home :) . In the solution package you just deployed there is another web part named Very Bad WebPart. This one is going to try to write „Romeo loves Juliet“ for indefinite number of times on a web part page. But don’t you worry, if it is deployed as SandBox Solution there is no way it can put your farm in any kind of danger.

Once deployed to a web part page it is going to be rendered as:

SharePoint 2010 SandBoxed solutions run as isolated and monitored process. In case unusual operation like the one above is detected the process will finalize its execution.

Monitoring SandBox Solutions

As Site Collection administrator you can monitor resource usage of SandBox solutions via Site Actions > Site Settings > Galleries > Solutions. The simple dashboard shows how much resources have been consumed by deployed solutions. To learn more about SharePoint resource usage configuration click here.

Interested in SandBox Solutions? Stay tuned as I will be posting some interesting samples in next few posts.



About

Real-life use case and opinions about collaboration, CRM and web technologies and stuff by Toni Frankola. More...

Categories

All postings on this blog are provided "AS IS" with no warranties, and confer no rights. All entries in this blog are my opinion and don't necessarily reflect the opinion of my employer.