Skip Ribbon Commands
Skip to main content
Sign In

Microsoft Playground

:

A Playground for Microsoft Technologies
Home
A Playground for Microsoft Technologies
January 06
Microsoft Certified Technology Specialist (MCTS): Microsoft .NET Framework 3.5, Windows Workflow Foundation Applications

18 months ago I decided to become Microsoft Certified Technology Specialist (MCTS): Microsoft .NET Framework 3.5, Windows Workflow Foundation Applications. I bought a book (Windows Workflow Foundation Step by Step) and started reading. After reading about 150 pages I was to busy to continue reading.

Three months ago I started reading the book again and I finally finished it just before the end of 2011.

Today I had my exam to my surprise I had to answer 70 questions were my past exams had only 50 questions. It was a really tough exam. I needed 140 minutes to finish the exam. 

But I passed the exam this is really one to be proud off! If you want to try this exam I really recommend you (when you read the some book) to look at the differences between WWF 3.0 and 3.5. Beside that I also recommend you to take this training (6462A: Visual Studio 2008: Windows Workflow Foundation (2 Days)) which one I did not attend.

 

IMG_0501[1]

December 13
Windows PowerShell command builder
Today I found something interesting on the internet which I think can help everyone who is working with SharePoint. Microsoft has built a Silverlight application that can be used to build PowerShell commands.
 
Windows Powershell Builder.png
 
 
Microsoft says:

the Windows PowerShell Command Builder enables IT professionals and power users to visually assemble commands related to SharePoint 2010 Products and Office 365 on a Design Surface in a browser and take those commands to their respective products. The Windows PowerShell Command Builder provides an intelligent user experience. After you drag a verb or noun object on the Design Surface, the interface will hide either the verbs or nouns that are not associated with the verb or noun placed on the Design Surface. After you construct a command, you can copy the command to Windows PowerShell script, the SharePoint 2010 Management Shell, or other desired location to be saved or executed.

You use the tool by clicking here. You can also install it on your desktop by right clicking on the application.

Microsoft also released some guides to get started with the tool:
November 17
System.ServiceModel.FaultException: The server was unable to process the request due to an internal error.

For one of our clients we are working with a claims based web application. This web application has a custom membership provider that is registered at the web application, central administration and security token service level.

When we navigate to the site everything works perfectly but when we try to login with valid credentials we would receive an error like below:

Server Error in '/' Application.


Runtime Error Description: An application error occurred on the server. The current custom error

The server was unable to process the request due to an internal error.  For more information about the error, either turn on IncludeExceptionDetailInFaults (either from ServiceBehaviorAttribute or from the <serviceDebug> configuration behavior) on the server in order to send the exception information back to the client, or turn on tracing as per the Microsoft .NET Framework 3.0 SDK documentation and inspect the server trace logs.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.ServiceModel.FaultException: The server was unable to process the request due to an internal error.  For more information about the error, either turn on IncludeExceptionDetailInFaults (either from ServiceBehaviorAttribute or from the <serviceDebug> configuration behavior) on the server in order to send the exception information back to the client, or turn on tracing as per the Microsoft .NET Framework 3.0 SDK documentation and inspect the server trace logs.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. 

Stack Trace:

[FaultException: The server was unable to process the request due to an internal error.  For more information about the error, either turn on IncludeExceptionDetailInFaults (either from ServiceBehaviorAttribute or from the <serviceDebug> configuration behavior) on the server in order to send the exception information back to the client, or turn on tracing as per the Microsoft .NET Framework 3.0 SDK documentation and inspect the server trace logs.]
   Microsoft.IdentityModel.Protocols.WSTrust.WSTrustChannel.ReadResponse(Message response) +1161205
   Microsoft.IdentityModel.Protocols.WSTrust.WSTrustChannel.Issue(RequestSecurityToken rst, RequestSecurityTokenResponse& rstr) +73
   Microsoft.IdentityModel.Protocols.WSTrust.WSTrustChannel.Issue(RequestSecurityToken rst) +36
   Microsoft.SharePoint.SPSecurityContext.SecurityTokenForContext(Uri context, Boolean bearerToken, SecurityToken onBehalfOf, SecurityToken actAs, SecurityToken delegateTo) +26405809
   Microsoft.SharePoint.SPSecurityContext.SecurityTokenForFormsAuthentication(Uri context, String membershipProviderName, String roleProviderName, String username, String password) +26406316
   Microsoft.SharePoint.IdentityModel.Pages.FormsSignInPage.GetSecurityToken(Login formsSignInControl) +188
   Microsoft.SharePoint.IdentityModel.Pages.FormsSignInPage.AuthenticateEventHandler(Object sender, AuthenticateEventArgs formAuthenticateEvent) +123
   System.Web.UI.WebControls.Login.AttemptLogin() +152
   System.Web.UI.WebControls.Login.OnBubbleEvent(Object source, EventArgs e) +124
   System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +70
   System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +29
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2981


In our situation this error occurs within in the “Security Token Service Application”. The problem with this error message is that it isn’t the exact message of what is going wrong. To receive that error message that is occurring do the following:

  1. Open IIS and navigate to “SharePoint Web Services” under “Sites”. Click the node open and select “SecurityTokenServiceApplication” use your other mouse button to open the context menu and select “Explore”.
    image_thumb[5]
  2. Windows explorer will open a new window. In this window you will see a web.config file. Open this file within a text editor and look for the following section:
<behaviors>
  <serviceBehaviors>
    <behavior name="SecurityTokenServiceBehavior">
      <!-- The serviceMetadata behavior allows one to enable metadata (endpoints, bindings, services) publishing.
           This configuration enables publishing of such data over HTTP GET.
           This does not include metadata about the STS itself such as Claim Types, Keys and other elements to establish a trust.
      -->
      <serviceMetadata httpGetEnabled="true" />
      <!-- Default WCF throttling limits are too low -->
      <serviceThrottling maxConcurrentCalls="65536" maxConcurrentSessions="65536" maxConcurrentInstances="65536" />         
    </behavior>
  </serviceBehaviors>
</behaviors>

In this section we will place a extra debug tag to include the errors that are occurring. The tag looks like this:

<serviceDebug httpHelpPageEnabled="true" includeExceptionDetailInFaults="true" />

This tag needs to be placed in the behavior tag. After you place the tag in the section it will look like this:

<behaviors>
  <serviceBehaviors>
    <behavior name="SecurityTokenServiceBehavior">
      <!-- The serviceMetadata behavior allows one to enable metadata (endpoints, bindings, services) publishing.
           This configuration enables publishing of such data over HTTP GET.
           This does not include metadata about the STS itself such as Claim Types, Keys and other elements to establish a trust.
      -->
      <serviceMetadata httpGetEnabled="true" />
      <!-- Default WCF throttling limits are too low -->
      <serviceThrottling maxConcurrentCalls="65536" maxConcurrentSessions="65536" maxConcurrentInstances="65536" />
      <serviceDebug httpHelpPageEnabled="true" includeExceptionDetailInFaults="true" />
    </behavior>
  </serviceBehaviors>
</behaviors>

After changing the “web.config” we received the correct message and we saw that we mistyped the role provider name.

Server Error in '/' Application.


Cannot get Role Manager with name Empty. The role manager for this process was not properly configured. You must configure the role manager in the .config file for every SharePoint process.

November 04
Using the ConditionedActivityGroup in Workflow Foundation 3.5

When you create a SharePoint approval workflow the While activity is often used to check if a Task is approved by placing the “OnTaskChanged” activity within the While Activity.

workflow

When you also want to check if the Moderation status on the workflow item is approved you can’t do this in the same While activity.

If you only check the task status there will be situation in which the item is approved and the approval workflow is still running because the item was approved directly. If you would like to check de moderation status of an item and the task status you can use a “ConditionedActivityGroup”.

The “ConditionedActivityGroup” will cause the workflow to continue when the moderation status is changed or when the status of the task is changed. To use the “ConditionedActivityGroup” drag the activity within the workflow designer.

Workflow_ConditionedActivityGroup

Next drop the activities you want to check within the small window at the top that states “Drop Activities Here”. For our example we will use the “OnTaskChanged” and the “OnWorkflowItemChanged” activities.

Workflow_ConditionedActivityGroup_Activities

Open the workflow in code view and add three boolean properties:

  • IsFinished
  • EnableItemChanged
  • EnableTaskChanged
public bool IsFinished { get; set; }

public bool EnableItemChanged { get; set; }

public bool EnableTaskChanged { get; set; }

These properties will be used to activate the conditions within the condition group. The “IsFinshed” property will be used to finish the conditioned group. To activate the conditions we will also have to set the “EnableItemChanged” and “EnableTaskChanged” properties to true within the initialization of the workflow.

/// <summary>
/// Initializes a new instance of the worfklow.
/// </summary>
public Workflow1() {
    InitializeComponent();
    this.EnableItemChanged = true;
    this.EnableTaskChanged = true;
}

 

After writing those lines of code open the workflow designer and select the “ConditionedActivityGroup” and change the “UntilCondition” property of the activity to: Declarative Rule Condition.

Select the “…” at the end of the “ConditionName” property and create a new “Condition”. The value of the condition has to be “this.IsFinished”.

Condition

This will mean that the ConditionedActivityGroup is finished when “IsFinished” equals true.

The next step is to set the “WhenCondition” on the activities that are in the group activity. These properties we also be a “Declarative Rule Condition” and set the condition values to “this.EnableTaskChanged” for the task activity and “this.EnableItemChanged” for the item activity.

Besides this we will also set the “Invoked” property of the activities to perform a code action when the event take place (You can also let Visual Studio do this by double clicking the activities).

 

WhenCondition

 

With all this in place when can start to write some code for the invoke methods. Because the “WhenCondition” mean that when they are set to true these conditions can occur. We will have to set these properties to true each time a Condition is met because the Workflow instance will automatically set them to false. In our example this will occur when the task status is set to approved or the item is approved.

public const string FieldId = "YourFieldID";

/// <summary>
/// Tasks the item changed.
/// </summary>
/// <param name="sender">The sender.</param>
/// <param name="e">The <see cref="System.Workflow.Activities.ExternalDataEventArgs"/> instance containing the event data.</param>
private void TaskItemChanged(object sender, ExternalDataEventArgs e) {
    //retrieve the task and check its status
    SPListItem task = workflowProperties.TaskList.GetItemById(CreateTaskActivity.ListItemId);
    string status = task[YourFieldID] != null ? task[YourFieldID].ToString() : string.Empty;

    if (status.ToUpperInvariant() != "PENDING") {
        IsFinished = true;
        EnableTaskChanged = false;
    } else {
        IsFinished = false;
        EnableTaskChanged = true;
    }
}

/// <summary>
/// Workflows the item changed.
/// </summary>
/// <param name="sender">The sender.</param>
/// <param name="e">The <see cref="System.Workflow.Activities.ExternalDataEventArgs"/> instance containing the event data.</param>
private void WorkflowItemChanged(object sender, ExternalDataEventArgs e) {
    //View the moderation status of the workflow item
    SPModerationStatusType type = workflowProperties.Item.ModerationInformation.Status;
    Status = type.ToString();
    if (type == SPModerationStatusType.Approved || type == SPModerationStatusType.Denied) {
        IsFinished = true;
        EnableItemChanged = false;
    } else {
        IsFinished = false;
        EnableItemChanged = true;
    }
}

 

When you set the “IsFinished” property to true the “ConditionedActivityGroup” will finish. And by setting the “EnableItemChanged” and the “EnableTaskChanged” property to true you inform the “ConditionedActivityGroup” that that condition can occur again.

November 01
Deleting a Project Service Application within SharePoint 2010

A couple of days ago I deleted my Project Server Web application because I wanted to recreate it.

When I tried to create a new Project Web App Site I got the following messages:

  • The database specified is already used by another project server. Enter a different server or database name and try again.

projectserver

The first idea that I came up with was deleting the databases from the database server. After deleting the databases I retried my action but the problem was still there.

The next thought that came up in my head was deleting the Project Service Application. I pressed delete on the Manage Service Application Page and got the following error message:

  • Service application cannot be deleted due to existing project sites.

errordeleteprojectserviceapplication

The problem is with the Project Service Application. The Project service application remains a connection with a specific site collection even If you delete the web application or the specific site collection. The only thing you can do to delete the connected site collection (that does not exist anymore) from the Project Service Application by using PowerShell.

First you will have to use PowerShell to retrieve a collection of the sites that are referenced with the service application. Get the ID of the reference you want to remove and than remove that reference .

Let take the first step, get the service application and print the site collections.

$svApp = Get-SPServiceApplication -Name "Project Web App Service Application"
$svApp.SiteCollection 

This will get a complete list of all the associated site collections:

powershelloutcome

Next you can copy the ID and remove it by using the following PowerShell command:

$svApp.SiteCollection.Remove("a09c6964-efc2-4917-9448-ce86d0bc95d3")

And now you can remove the Service Application or recreate the site collection. To remove the service application by using powershell use the following command:

Remove-SPServiceApplication $svApp -RemoveData
September 20
Slow file transfer from Windows Explorer view to another Windows Explorer view of SharePoint.

Today I was replacing certain SharePoint documents for one of the projects we are working on. I noticed that the transfer of the document from Windows Explorer View to Windows Explorer view was very slow!! I mean 16,1 kb per Second slow!!!.

Investigating this problem I found that IE is configured to “Automatically detect settings”:

image

This was causing the Webdav connection to work very slow. Disabling this obtain automatically made my transfer much faster. You can find this option by doing the following:

  1. In IE open the tools menu and click on Internet options.
  2. Click on the connections tab.
  3. Click on the Lan settings button.
  4. Uncheck the Checkbox and press ‘Ok’ to save the settings.
September 02
Deleting the extended web application

This post I’m as a reminder because a few days back when I was working on a production environment for one of our clients. I had created an extended web application and needed to remove it. In SharePoint 2007 I have done this several times but in 2010 I had to take a good look.

To delete the extended web application you need to do the following:

 

    1. Start Central Administration.
    2. Go to Manage Web Applications.
    3. Select the web application you extended.
    4. Click on the Arrow beneath Delete and select Remove SharePoint from IIS Web Site.
    5. Select the Web site.
    6. Finally click OK
August 30
Visual Studio cannot debug managed applications because a kernel debugger is enabled on the system.

I developed some awesome features for my SharePoint environment and to my Surprise they weren’t working that well.

So I thought lets attach it to the debugger and take a look what is going wrong. When I attached the debugger I got the following error message:

“Visual Studio cannot debug managed applications because a kernel debugger is enabled on the system.”

After a couple of hours investigating the problem I found a strange behaviour on the start up of my development machine it was starting up in some kind of debug mode. To check if you machine is running in debug mode do the following:

  1. Start – Run – msconfig
  2. Select the boot tab and click on advanced options.
  3. If the debug check box is marked it is running in a debug mode.

image

Unmark the checkbox and you will be able to debug your code.

August 26
Birth of my Beautiful son Tibbe Abbel van der Gaag

For the last couple of weeks it has been quiet on my blog. It also has did not work for almost a week. This was all because of the birth of my son Tibbe.

He was born on 11 July and he is now 6 weeks and 3 days old.

IMG_0270

In the following weeks I will be picking up a lot of work and I will again be posting some interesting SharePoint stuff!!!!

July 01
Office 2010 and SharePoint 2010 Service Pack 1

Two days ago Microsoft released the first Service Pack for the 2010 Office suite. This means there is also a Service Pack for SharePoint 2010.

In the Office service pack there are a lot of fixes and to much to list here. Here are some changes:

  • Outlook fixes an issue where “Snooze Time” would not reset between appointments.
  • The default behaviour for PowerPoint "Use Presenter View" option changed to display the slide show on the secondary monitor.
  • Integrated community content in the Access Application Part Gallery.
  • Better alignment between Project Server and SharePoint Server browser support.
  • Improved backup / restore functionality for SharePoint Server
  • The Word Web Application extends printing support to “Edit Mode.”
  • Project Professional now synchronizes scheduled tasks with SharePoint task lists.
  • Internet Explorer 9 “Native” support for Office Web Applications and SharePoint
  • Office Web Applications Support for Chrome
  • Inserting Charts into Excel Workbooks using Excel Web Application
  • Support for searching PPSX files in Search Server
  • Visio Fixes scaling issues and arrowhead rendering errors with SVG export
  • Proofing Tools improve spelling suggestions in Canadian English, French, Swedish and European Portuguese.
  • Outlook Web Application Attachment Preview (with Exchange Online only)
  • Office client suites using “Add Remove Programs” Control Panel, building on our work from Office 2007 SP2

Issues that are fixed for SharePoint 2010 can be read in the following excel sheet:

You can find the updates on the Microsoft update center:

1 - 10Next
About this blog
Microsoft Playground is a blog for every Microsoft Technology out there.
View Maik van der Gaag's LinkedIn profile Facebook Follow Smeikkie on Twitter