1

[ short reminder: english is not my native language :) ]

Hello, I have this problem for a few days now (and it starts to drive me seriously mad).

Like the title says, my problem is that I need to change the "update rules"-parameter of a (before created) KpiListItem programmatically within a workflow. It's not an issue to access the Item itself or anything, but I can't find a mean to access the parameter. I found a possible solution (tutorial) to access it with the KpiFactory (source), but this examples already stucks in my code on the line where I try to invoke the "GetKpiData"-Function: (Giving me an exception because of the emty object-array..., but it's impossible to get some information about the parameters for the GetKpiData-function on the net, the SDK or some books I checked)

SPListItem item = newWeb.Lists[nameIndicatorList].Items[0];
Assembly asm = System.Reflection.Assembly.Load("Microsoft.SharePoint.Portal, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c");
Type t = asm.GetType("Microsoft.SharePoint.Portal.WebControls.KpiFactory");
MethodInfo mi = t.GetMethod("GetKpi", BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Static, null, new Type[] { item.GetType() }, null);
object kpi = mi.Invoke(null, new object[] { item });
mi = kpi.GetType().GetMethod("GetKpiData", BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance, null, new Type[] { }, null);
object kpidata = mi.Invoke(kpi, new object[] { });

(The item-object is the indicator I want to access)

Anyway, I followed the tutorial just to test if the property is even reachable. If this works, it would only be an half step forward, because in the end I want to change the property and not just read it.

I hope that someone has a solution for my specific problem. It really gives me a headache. (Even partial anwser may help.)

sincerely, Markus Schwalbe

Markus Schwalbe
  • 123
  • 2
  • 11

1 Answers1

0

You tagged the question as being Sharepoint 2010 related, but in the code you included, you try to load the 12.0.0.0 version of the Microsoft.SharePoint.Portal DLL. Is either a typo or could that be the problem (meaning that if you ARE using SP2010, you should have the code load the 14.0.0.0 version of the Microsoft.SharePoint.Portal DLL.

Colin
  • 10,630
  • 28
  • 36
  • thanks I must have overlooked it... but unfortunally that wasn't the source of the problem either. I still get an exception on the last line, probably because of the second parameter of the Invoke-method (even thought the tutorial says that it's fine that way...). – Markus Schwalbe Jan 10 '11 at 13:43