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.

Tuesday, October 11, 2011

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

Tuesday, September 28, 2010

Get Free Exam vouchers with 20% discount with Free Secondshot

Get Free Exam vouchers with 20% discount with Free Secondshot.  This can be used for MCP/MCTS/Dynamics exams.  Simply email the following details to vmaceda at hotmail dot com:

Country:
Number of Exam Vouchers:

Tuesday, September 21, 2010

Remap user permissions to objects in the database

There's a time where you need to restore a prod database over a test database. Then all permissions in the stored procedures were gone. To fix this execute the following command:

EXEC sp_change_users_login 'Auto_Fix', ''

This will remap the database users login to the right objects.

**This must be done to all database user

Serious ASP.NET exploit

A serious ASP.NET exploit has been discovered. It can be used to decrypt viewstate, remotely log in as any user and potentially gain control over a server.

 
http://www.youtube.com/watch?v=yghiC_U2RaM


The exploit works by firing thousands of requests at a website, examining the returned error messages for information and eventually collecting enough information to derive the server's encryption key. Any ASP.NET website that doesn't return a static error page can be hacked using this method.

 
http://weblogs.asp.net/scottgu/archive/2010/09/18/important-asp-net-security-vulnerability.aspx