Technical Fun

Archive for November 2007

I spend half of the day configuring K2[blackpearl] in my dev environment.
Initially I got errors and was unable to start the K2[blackpearl] host service and my workspace emitted errors saying that the target machine actively rejected my connection.

Another panic moment …
but then after I contacted their support team, they simply confirmed that at this moment, K2[blackpearl] got some issues when installed on a hard drive that is not the C:\ drive.

Nice. I had to re-do all of the installation.

Lessons (will be updated as I venture further):

- For now, do not install K2[blackpearl] on drives other than C:\ <-- fixed in SP1

[update #1] after cleaning everything (including databases) and a re-installation, I got a successful K2[blackpearl] installation,… this time with a NON-WORKING K2 Web Designer for SharePoint.. OMG ..

[update #2] I got the K2 Web Designer working after I activate it in K2 Administrator tab on the Central Admin. My fault, my bad, sorry, okay? Now I am struggling to improvise with it.

[update #3] A very kind reader has pointed out that the non-C:\ drive installation is now fixed on SP1, as well as a bunch of other improvements.


As many have had, I applied KB934525 to my company’s MOSS environment.
We had two web front ends, and one clustered database serving everything.
Obviously, we had an error completing the configuration wizard after the upgrade binaries were installed.
It is solved by the famous command line mentioned in Bill Baer‘s blog:

psconfig -cmd upgrade -inplace b2b –force

This command solved our upgrade error on both web front ends.

A few days afterwards, we noticed something funny was happening inside our very MOSS system.
The usage analysis job WAS NOT RUNNING ON the main web front end!!
AND… Our Windows Sharepoint Web Services (a required service that should run on a FARM) was not running on the main web front end (it said Upgrading), AND that service is in the state of Stopping on the other web front end.
Whoaaa .. how could this be??

Panic was in the air, and after a deep dive into the realm of modern contemplation,
this line of command was executed:

stsadm -o provisionservice -action start -servicetype SPWebService

to actually force the service to start on the main web front end. We also force stop the service on the other front end.
It brought back the services to its desired state. (Running on my main one, and Stopped on the other web front end).

It screwed the home directory of my MOSS web site inside IIS(as it defaulted back to C:\Inetpub\blablabla), but then everything was back to normal once I supplied my original MOSS web site path.

After all the chaos, my usage analysis job was back to normal again.

Have you ever desired to pull the content of your CRM picklist attributes and show it to the world using other presentation method? No? really? why? hhh… so sad.
But for those of you who bears the same desire as mine, here’s a little help.

Remember that oMds is an instance of CRM Metadata web service.

private PicklistAttributeMetadata getPickListValue(string entityName, string pickListAttributeName)
AttributeMetadata amd = oMds.RetrieveAttributeMetadata(entityName,pickListAttributeName);
PicklistAttributeMetadata pl = (PicklistAttributeMetadata)amd;
return pl;

As you see, that method will return PicklistAttributeMetadata, which containes Options attribute, that you can iterate later, like this:
Assume that you have an entity named “new_suppliers” and a picklist attribute called “new_supplierstype”.

PicklistAttributeMetadata pam = getPickListValue("new_suppliers","new_supplierstype");
foreach (Option o in pam.Options)
lstAttribute.Items.Add(o.Description); //i.e: you got a listbox called lstAttribute and decided to bind the picklist to it.

Ok? No? eh? Why ..? hhh .. so sad..

Tags: ,

Once upon a time, a narcissist felt the urge to display his assembly version to the crowd.
He had edited the AssemblyInfo.cs’ AssemblyVersion attribute to use 1.0.0.*.
Now, he wanted everyone to see the strange numbers of his assembly version.

He referenced System.Reflection carefully,
He then called these lines solemnly

Assembly asm = Assembly.GetCallingAssembly();
string version = asm.GetName().Version.ToString();

He chuckled in an insane glee, and disappeared, never again seen.
He had reached the Nirvana.

Tags: ,

I wanted to deactivate an entity member and was confused.
Here’s to get you out from the same headache.
Replace ENTITYNAMEHANDLER with your entity’s name.

(note that oCrm is an instance of the Crm Web Service)

SetStateENTITYNAMEHANDLERRequest state = new SetStateENTITYNAMEHANDLERRequest();
state.EntityId = new Guid(GUID_OF_THE_TARGET_MEMBER);
SetStateENTITYNAMEHANDLERResponse stateSet = (SetStateENTITYNAMEHANDLERResponse)oCrm.Execute(state);

With that, you’re done :), are you? eh? really? huh? …

Tags: ,

Let’s say I got a custom content type called “Boring Items” on my SharePoint list. It got some specific fields bound to it.
Now, I want to add an item to that list which will use the “Boring Items” content type. How?

First, perform the usual ritual of calling the SPSite and SPWeb thing, then find the list of your target, and grab its’ items [can be like this, but not necessarily has to be]:

SPSite site = new SPSite("http://YOUR_SITE_URL");
SPWeb web = site.OpenWeb();
SPList list = web.Lists["YOUR_LIST_NAME"];
SPListItemCollection items = list.Items;

Then, bind it to the desired content type

SPContentType itemtype = list.ContentTypes["Boring Items"];
SPListItem newitem = items.Add();
newitem["ContentTypeId"] = itemtype.Id; //VOILA!

Continue adding the necessary field, and don’t forget to call the Update() method once you’re done.

Being an information worker is fun, and full of technology hiccups.
This blog aims to share all of those in forms of short postings, or probably if I got bored enough, I will write those things in a form of poem, song, or whatever i can pull out then.
So watch out for MOSS, CRM, and regular .Net trivias, eurekas, and mamamias here.

Over and out now.