开发者

Changing the "update rules"-parameter of a KpiListItem in SharePoint 2010 programmatically

[ 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 possi开发者_JAVA百科ble 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


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜