Welcome on my SharePoint 2010 blog

Hello,

My name's Roy. I'm a dutch SharePoint & BI consultant/architect at Advantive B.V. At this moment I'm busy with some big SharePoint 2010 projects in The Netherlands. In all the projects I've got different roles, like: Business consultancy, Lead Consultant, Architect (logical and technical), Development and Teaching/courses.

Products where you can ask me about are: SharePoint, Visual Studio, SQL Server, PowerPivot, Analysis and Reporting Services, Visio Services, InfoPath, PerformancePoint Services, Team Foundation Server, Office line.

I love to work and to write about Microsoft SharePoint 2010 so, feel free and read/comment my Blogs!

Greetz.

Saturday, October 23, 2010

SharePoint 2010 and Windows 2000 Active Directory

In the last months I've had two installs/configs of SharePoint 2010. In both situations SharePoint is installed on a Windows 2008 R2 server. That's fine for so far, but:

They are both linked to a Windows 2000 AD environment. And I think you can already guess it, that doesn't work Out-Of-The-Box....

The problems you get is that you can't get authenticated in SharePoint and when you think to give the AD user more rights (as well in SharePoint as in AD) you see question marks in front of the user ID (on the Windows 2008 R2 server), the user name/id and the complete SID.



That doensn't look good.... so go and investigate for the solution!

Solution to let SharePoint 2010 work with Windows 2000 AD:

On the 2008 servers - In GPEDIT.MSC > Computer configuration > Windows Settings > Security Settings > Local Policies > Security Options.

Domain Member: Digitally encrypt or sign secure channel data (always)  - Set this to Disable
Domain member: Digitally encrypt secure channel data (when possible) Set this to Disable
Domain member: Digitally sign secure channel data (when possible)   Set this to Disable

Then reboot the Windows 2008 R2 server to refresh the policy settings.

But after all the best solution is to upgrade your AD environment to the latest version.

Wednesday, October 20, 2010

Extending the ribbon: Webpart contextual tabs

This Blog will talk about creating a webpart contextual ribbon tab" in SharePoint 2010 on a high level.

With this solution the tab(s) will be visible when the specific webpart will be on the page.

Create a SharePoint visual studio 2010 visual webpart project with the following ingredients:
  • JS.file
  • WebPart
  • XML-files
The js.file contains the functions and methods to put the necessary tabs, groups and buttons to the ribbon.

In the XML-files you can find the tab and the groups with it's buttons and it's behaviour. In this file you can only find a shortcut to the event handler that will be fired when the button in the ribbon is clicked. In the feature the xml sections will be added to the cmdgui.xml file in the 14-hyve. The ribbon tab is a normal ribbon tab and not a contextualtab (like doc library (documents, library)).

The WebPart contains code in the prerender method to:
  • read the xml-files for the tabgroups and tabs
  • put the xml in the OOB SharePoint cmdgui.xml file
  • put in some code for the event handler
  • Include the javascript file

Thursday, October 14, 2010

PowerPivot: make the end users a BI Specialist

Intro
In most of the organizations Business Intelligence (BI) is a hot subject. Most of the management information is created by the IT-departments (OLAP cubes, reports, dashboard, etc). But the ad hoc information will be created by the end user, and most of the time in Excel (familiar application). This information in these sheets is decentrally managed and stored. The problem with these decentrally managed sheets is the fact that people can make critical decisions based on this information and the organization doesn’t know that it exists.
PowerPivot Client
Microsoft resolves this by giving end users a perfect alternative option using the PowerPivot Client and PowerPivot for SharePoint. Users are familiar with Excel and can make use of Excel and the extended PowerPivot tools by downloading the free add-in from http://www.powerpivot.com.
In Excel you get new options added like slicers, with slicers you can slice and dice through your data in Excel, which Is really powerfull in combination with PowerPivot.
Thanks to PowerPivot pivot tables in Excel are no longer based on cells but on tables like in a real database (datasources that can be easily connected are: SQL, Azure, Oracle, Excel and Atom). The information will be physically transferred to PowerPivot.
PowerPivot makes use of an in-memory engine (called VertiPaqengine) in Analysis Services, thanks to this engine it is possible to analyse and transform the data on the workstation of the end user. To use million rows of data PowerPivot uses column compression. Under the hood the engine is a simple version of Analysis Services. With column compression duplicate values will only be saved once, all the duplicate columns will be saved as a shortcut.
PowerPivotLanuage
PowerPivot has got his own function language called Data Analysis Expressions (DAX). With DAX aggregations can be made dynamically based on relational database concepts and an Excel look-a-like syntax. In your PowerPivotresultset (Excelsheet) you can easily add columns based on the columns of your resultset. The formulas will be entered in the familiar Excel formula box.
PowerPivot Server
Users can easily share their PowerPivot files to publish them to SharePoint 2010 in the PowerPivot gallery. In this Silverlight based gallery all the PowerPivot workbooks will be saved and a thumbnail will be shown. The workbooks will be opened (when installed) via Excel Services. So to view PowerPivot files in SharePoint no client installation of PowerPivot and Excel is necessary.
PowerPivot management
The IT department can see the use of the PowerPivot applications by using the PowerPivot Management Dashboard. Thanks to the dashboard the IT department can see if an application is used ad hoc or permanently. When the PowerPivot application will be heavily used , the IT department can decide to create a “static” dashboard for it.

Monday, October 11, 2010

Failover principal SP2010 service applications

I hope I will help a lot of people with this new blog about the OOB failover principal that comes with SharePoint 2010. Please read the following:

You can find a lot of information about the failover principal for OOB service applications, things like: "It is based on Round Robin...", "if one service app is down, the first available one will be used..." and  "This whole principle is embedded in the application discovery and load balancer service application....".



All of the above statements are true, BUT....How does it really work under the hood....That answer you can find from now on in this blog and the answer is pretty simple!!

There is a timer job OOB within the central administration that checks which services on the specific appservers are up and running (application discovery). If so, it cleans and re-creates the connections/addresses to the working services.

SharePoint will directly act when a service that represents a specific service application is down. Example:

2 servers that have an active metadata service. The services are connected to the metadata service application. When the service on the first service (order of the services for the SP NLB) goes down (or both services go down), you cannot use the metadata tree throughout your SharePoint UI. The load balancer service application will not directly change the address to the other server when, because this service application does'nt discover immediatly. This will be done by the timer job that will run every 15 minutes (by default), it is called: Application Addresses Refresh Job

So, when one or all of the services for a specific service application are down, you can see it immediately throughout the UI of SharePoint. But the timerjob will discover the services again to reconnect to the first available one. Of course, because it's just a normal timer job, you can reschedule it.

Thursday, September 30, 2010

Editing User Profile properties Cross Farm

Problem:

2 farms:
Farm 1 (publishing farm (PF)):
Service applications (User profile and metadata services)

Farm 2 (consuming farm (CF)):
Webapplications (my.portal.nl webapplication).

I published all the services on the PF and succesfully made a connection to the service throughout the CF. The mysite host location is created under the my.portal.nl webapp.

Everything seems to work perfect. The only thing that doesn't work is the following: When I open the my site host and want to edit my profile properties all the fields that need keywords or metadata are not reachable. When I put the my site host location on the publishing farm --> IT WORKS....

I get the red error beneath every EMM field that says: "the service is temporarily disabled...."




Thursday, September 9, 2010

Building custom actions in SP Designer 2010

Situation:

When you want to use the managed metadata fields in SharePoint Designer 2010 in e.g. an e-mail message then you get the following information back from the system:

<Guid>|<Termtext>

If you want to split this string array (devided by a pipeline) with SharePoint Designer, it's by default not possible. SharePoint Designer doesn't have any actions to split a string or a string array.

Solution:

With Visual Studio 2010 I created a feature with a feature receiver. This feature will activate a part in the web.config file:

"<authorizedType Assembly=\"SPDWorkflowStringActions, Version=1.0.0.0, Culture=neutral, PublicKeyToken=5b2222d748ee56b1\" Namespace=\"SPDWorkflowStringActions\" TypeName=\"*\" Authorized=\"True\" />";

Next to that you will create some string methods and necessary properties into separate classes. I have the following:



Next to the string methods and properties (the intelligence) you need to make it User Friendly in SPD2010. Therefore I added a predefined XML-file (with the extension .actions). In this file I create the buttons/links that will make it possible that I can use my string options (the following is a part of this XML).

<WorkflowInfo>
  <Actions Sequential="then" Parallel="and">
    <Action Name="Contains()"
     ClassName="SPDWorkflowStringActions.Contains"
     Assembly="SPDWorkflowStringActions, Version=1.0.0.0, Culture=neutral, PublicKeyToken=5b2222d748ee56b1"
     AppliesTo="all" Category="String Actions">
      <RuleDesigner Sentence="Determine if %1 contains a value of %2 and output a value of true or false to %3." AppliesTo="all" Name="Contains">
        <FieldBind Field="InParam1" Id="1" Text="String"/>
        <FieldBind Field="InParam2" Id="2" Text="String"/>
        <FieldBind Field="OutResult1" DesignerType="ParameterNames" Id="3" Text="Output result #1" />
      </RuleDesigner>
      <Parameters>
        <Parameter Name="InParam1" Type="System.String, mscorlib" Direction="In" InitialValue="empty" />
        <Parameter Name="InParam2" Type="System.String, mscorlib" Direction="In" InitialValue="empty" />
        <Parameter Name="OutResult1" Type="System.String, mscorlib" Direction="Out" />
      </Parameters>
    </Action>
    <Action Name="EndsWith()"
     ClassName="SPDWorkflowStringActions.EndsWith"
     Assembly="SPDWorkflowStringActions, Version=1.0.0.0, Culture=neutral, PublicKeyToken=5b2222d748ee56b1"
     AppliesTo="all" Category="String Actions">
      <RuleDesigner Sentence="Determine if %1 ends with a value of %2, and output a value of true or false to %3." AppliesTo="all" Name="EndsWith">
        <FieldBind Field="InParam1" Id="1" Text="Input parameter #1"/>
        <FieldBind Field="InParam2" Id="2" Text="Input parameter #2"/>
        <FieldBind Field="OutResult1" DesignerType="ParameterNames" Id="3" Text="Output result #1" />
      </RuleDesigner>
      <Parameters>
        <Parameter Name="InParam1" Type="System.String, mscorlib" Direction="In" InitialValue="empty" />
        <Parameter Name="InParam2" Type="System.String, mscorlib" Direction="In" InitialValue="empty" />
        <Parameter Name="OutResult1" Type="System.String, mscorlib" Direction="Out" />
      </Parameters>
    </Action>

This part will be added to the default SharePoint .actions file.

When we deploy the project in Visual Studio 2010 and activate the WebApp scoped feature we'll can use the buttons in SharePoint designer.

For more information please let me know and I can send you the project files.


Wednesday, August 18, 2010

SPMetal & LINQ to SharePoint 2010

Intro
Within SP2010 you have the possibility to reach and use your lists and libraries using Language Integrated Query (LINQ).

LINQ is a feature of the programming languages C# and Microsoft Visual Basic .NET. Compilers are included with Visual Studio.

LINQ adds a SQL-like syntax and vocabulary to each of the languages, which can be used to query data sources. But unlike other languages and query syntaxes which vary from one type of data source to another, LINQ can be used to query, in principle, any data source whatsoever. For this reason, developers may find that it is the only query syntax that they ever need to know.
All that is necessary to make a data source accessible with LINQ is that someone create a LINQ provider for the data source.

A LINQ provider is an implementation of the System.Linq.IQueryable<T> and System.Linq.IQueryProvider interfaces that are included with Microsoft .NET Framework (System.Core.dll). The implementing classes must be public in a managed code assembly. The primary job of the class that implements IQueryProvider is to translate LINQ queries into the language of the data source, such as SQL or XQuery, then call the data source’s application to execute the query.

The provider must also expose a gateway class whose instances can communicate with the data source and output IEnumerable<T> objects. For example, the gateway class for LINQ to SQL is DataContext and the gateway class for LINQ to XML is XDocument. The gateway class must implement System.Linq.IQueryable<T> or have a child property that does so or have a method that returns a type that implements System.Linq.IQueryable<T>. For example, DataContext has a GetTable() method that returns a Table<TEntity> type that implements System.Linq.IQueryable<T>. The latter interface, in turn, has a property of type IQueryProvider. (The gateway class can also directly implement IQueryProvider.) It is objects of type Table<TEntity> that are queried.

In many cases, a LINQ Provider cannot be used by a .NET solution developer unless the developer creates a set of entity classes to represent the subordinate entities in the data source, such as the particular tables of a particular SQL database. Frequently, a lot of such classes must be created (e.g., a database with three dozen tables), so the developer of a LINQ provider will typically include a code generation tool to automate the process of creating these entity classes.

The LINQ to SharePoint Provider is defined in the Microsoft.SharePoint.Linq namespace. It translates LINQ queries into Collaborative Application Markup Language (CAML) queries. It is no longer necessary for developers to know how to write CAML queries. LINQ queries can be used in server code. To query from a client application, use SharePoint’s support for ADO.NET Data Services.

The gateway class for the LINQ to SharePoint provider is Microsoft.SharePoint.Linq.DataContext which represents the data of a SharePoint Foundation Web site. It is parallel in use and function to the System.Data.Linq.DataContext class in the LINQ to SQL provider. Just as the latter class has a GetTable() method that returns a Table<TEntity> object that implements System.Linq.IQueryable<T>, so too, the Microsoft.SharePoint.Linq.DataContext class has a GetList<T> method that returns an EntityList<TEntity> class that implements System.Linq.IQueryable<T>. It is objects of type EntityList<TEntity> that are queried.

How to use
  1. To use LINQ to SharePoint 2010 you have to create a new empty SharePoint visual webpart (example) project in Visual Studio 2010.
  2. Go to cmd-prompt and open the BIN-directory in your 14-hyve.
  3. Enter the following command (launch the spmetal.exe): SPMetal.exe /web:http://yoursite /code:C:\ExampleEntities.cs. The system wil now create a cs-file that you have to include in your project. In this file you can find all your lists and doc libs and fields that you can use in your LINQ queries. Note that the class name is now ExampleEntitiesDataContext. It's based on the name you specify as your code file in the SPMetal.exe command line tool.

    If you were to use /code:C:\Awesome.cs instead, it would generate a class called AwesomeDataContext.
  4. So far so good.... now the cs-file is included in your project, you can use it. Now you have to make an instance of the ExampleEntitiesDataContext class and make an example query:ExampleEntitiesDataContext edc = new ExampleEntitiesDataContext(SPContext.Current.Web.Url); var q = from Example in edc.Documenten where Example.DocumentCreatedBy == "Test" select Example.DocumentCreatedBy;
  5.  You can now use the results in a for each loop, BUT.... sometimes the SPMetal.exe makes some mistakes in his automatic process with custom lists and libraries. When you want to choose a field in your table, you can only see the system fields...

6. The problem: The SPMetal.exe does'nt use the content types that are connected to the list, he takes the default content type for a list: Item and for a Library: Document!!!!

7. Solution: Open your ExampleEntities.cs file and search for your list from which you want to use the fields. In this property change the contenttype to the content type where your fields are in (see the yellow highlighted text):
[Microsoft.SharePoint.Linq.ListAttribute(Name="Documenten")] public Microsoft.SharePoint.Linq.EntityList<Document> Documenten { get { return this.GetList<Document>("Documenten");
}
}
8. Change the text to the content type you need. After that go back to your other cs.file (e.g.: for the webpart) and again open your field property box using intellisense. And....Yes!! There they are: Your fields from the specific content type!! HAVE FUN!!