Virtual Business Card


A Jack of all trades is a master of integration, as such an individual who knows enough from many learned trades and skills to be able to bring their disciplines together in a practical manner, and is not a specialist but can be an expert in many fields. Such a person is known as a polymath or a renaissance man; a typical example is someone like Leonardo da Vinci.

Monday, December 5, 2011

Running large complex workflow randomly fails

This problem might be caused by the large number of Types that are created during workflow compilation, for workflows with many local workflow variables. It is more common for workflows with multiple Approval Process actions, as each preconfigured Approval Process Action comes with a large set of local variables, for the different configurable property of the Approval Process.

RESOLUTION:

By installing a CU that includes the February 2011 CU or service Pack 1 which is the ideal solution, SharePoint administrators are able to prevent compilation of workflows whose compilation would affect the performance of the farm. The default value of the property "UserDefinedWorkflowMaximumComplexity" is 7000, but can be changed based on the needs and profile of the SharePoint farm. Try setting this property to a higher value using PowerShell:

$app = get-spwebapplication "[web app url]"
$app.UserDefinedWorkflowMaximumComplexity = 8000
$app.Update()

SPContext.Current.Web.Groups.GetByID() returns Unable to evaluate expression because the code is optimized or a native frame is on top of the call stack.

If you get this error, this is probably a permission problem and should return Access Denied. Try running the code
under SPSecurity.RunWithElevatedPrivileges.

Also check the group's property as by default it is set to be read by members only. Set it to everyone and you'll be sorted.

Tuesday, October 11, 2011

JQuery to Open Links in a New Window

The code below is very useful when displaying a SharePoint page using a minimalistic masterpage in an IFrame of CRM 2011 dashboards. So instead of the page opening inside the IFrame of CRM 2011, it will open a new page. Add code in the script tag:

$(document).ready(function() {
$('a').attr('target', '_blank')
});

Increasing Debug Time in Sharepoint 2010


If you’re developing for SharePoint 2010 the Application Pool has a setting called Ping Maximum Response Time with a default value of 90 seconds. In effect, this means that debugging your Web Part, Page, etc. in SharePoint 2010 will only work for 90 seconds and then you get this:

"The web server process that was being debugged has been terminated by Internet Information Services(IIS). This can be avoided by configuring Application Pool ping settings in IIS. See help for further details."

The error is really self explanatory and very helpful. To resolve this:


- Click on Start->run->inetmgr

- Locate your application pool and select Advanced Settings on the menu on the right

- Modify the value of Ping Maximum Response Time (Seconds)


You can also increase the value for future Application Pools via Set Application Pool Defaults by selecting the root node of Application Pools in IIS.

Accessing Workflow Status in a List

I have a CAML Query below that queries a list where the workflow for an item is not cancelled.  There's an extra column in the list called Recruitment Workflow which is of type WorkflowStatus.  This column is somehow automatically added by SharePoint.  I tried to query using CAML using the query below:
Note That I'm using the Internal Name for Recruitment Workflow Column in this query.
<Query>
       <Where>
                  <Neq>
                          <FieldRef Name="Recruitm" />
                          <Value Type="WorkflowStatus">Canceled</Value>
                 </Neq>
         </Where>
</Query>

Weird thing is I'm not getting any results.
I also tried to query everything to test my insanity and query and test if the column exsist:
foreach (SPListItem item in recruitmentrequests)
{
                item[“Recruitment Workflow”] =
               ….
}
It fails on  the underlined code and I got the error


item["Recruitment Workflow"]' threw an exception of type 'System.ArgumentException'
    base {System.SystemException}: {"Value does not fall within the expected range."}
    Message: "Value does not fall within the expected range."
    ParamName: null

I also replaced the code with  item[“Recruitm”] =

and I still got the error above.  I also tried item["Recruitment_x0020_ Workflow"];

and it generates an error saying that column does not exist.
I also checked via code if that column exists using item.Fields["Recruitment Workflow"] and it can retrieve it.

So this is really puzzling me.  The column is there but I cannot query it to get its value using CAML or .NET code.


It looks like accessing a workflow status is a special case and cannot be accessed via SPListItem["WorkflowStatusColumnName"].  You can access it using the snippet below:

using System;
using Microsoft.SharePoint;
using Microsoft.SharePoint.Workflow;
// This is Console Application //
SPSite site = new SPSite("http://sharepoint-site/");
SPWeb web = site.OpenWeb();
foreach (SPList list in web.Lists)
{
    foreach (SPListItem item in list.Items)
    {
        foreach (SPWorkflow workflow in item.Workflows)
        {
            try
            {
                Console.WriteLine("item url : " + item.Url);
                Console.WriteLine("workflow name : " + list.WorkflowAssociations[workflow.AssociationId].Name);
                Console.WriteLine("workflow status : " + item[list.WorkflowAssociations[workflow.AssociationId].Name]);
                Console.WriteLine();
            }
            catch (ArgumentException)
            {
                //ArgumentException is throwed if the workflow is not exist in the list column.
                Console.WriteLine("Workflow name : {0} is already not exist in List title : {1}.",
                    list.WorkflowAssociations[workflow.AssociationId].Name, list.Title);
            }
        }
    }
}



Wednesday, June 29, 2011

.NET Reflector Alternative

Since Redgate charges for a tool which was free for years, an alternative was born:

http://wiki.sharpdevelop.net/ILSpy.ashx

Thursday, June 23, 2011

Microsoft One Code


  • Are you frustrated by the lack of code samples for a certain programming task?
  • Have you ever struggled to quickly get started with a technique?
  • Have you expected someone to write code samples for you based on your requests for free?
  • Is a one-stop code sample library for all Microsoft development technologies attractive to you?
If your answer is YES to any of these questions, the Microsoft All-In-One Code Framework is for you!

The Microsoft All-In-One Code Framework is a free, centralized code sample library driven by developers' needs. Our goal is to provide typical code samples for all Microsoft development technologies, and reduce developers' efforts in solving typical programming tasks.


http://1code.codeplex.com/

Monday, June 6, 2011

Enabling Wifi in Dell XPS 15 running Windows Server 2008

If you got a Dell XPS 15 and you installed Windows Server 2008 because you want to use your beast to do some VM or development and you later found out that you cannot surf the web using your wifi here is the solution to solve this issue:

1.) Install the the drivers for Windows 7 for your card.  You can download this from the Dell website

2.) In your computer, press windows key + R

3.) Enter appwiz.cpl

4.) Click on Add Windows Feature

5.) Enable Wireless Lan Service

6.) The icon for the wireless will still be grayed out but if you click it you will see your router

7.) Connect as normal