以编程方式更改 SharePoint 2010 中 KpiListItem 的“更新规则”参数

发布于 2024-10-11 02:41:26 字数 1291 浏览 0 评论 0原文

[简短提醒:英语不是我的母语:)]

你好,我已经有这个问题几天了(它开始让我非常生气)。

就像标题所说,我的问题是我需要在工作流程中以编程方式更改(在创建之前)KpiListItem 的“更新规则”参数。 访问项目本身或任何东西都不是问题,但我找不到访问参数的方法。 我找到了一个可能的解决方案(教程)来使用 KpiFactory 访问它(source),但是这个示例已经卡在我尝试调用“GetKpiData”函数的代码行中:(由于空对象数组而给了我一个例外...,但是不可能在网上、SDK或我查过的一些书籍上获得有关GetKpiData函数的参数的一些信息)

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[] { });

(项目对象是我要访问的指标)

无论如何,我遵循了教程只是为了测试该属性是否可达。如果这有效,那只会向前迈出半步,因为最终我想更改属性而不仅仅是读取它。

我希望有人能解决我的具体问题。实在是让我很头疼。 (即使是部分答案也可能有帮助。)

真诚地, 马库斯·施瓦尔贝

[ 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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

跨年 2024-10-18 02:41:26

您将问题标记为与 Sharepoint 2010 相关,但在您包含的代码中,您尝试加载 12.0.0.0 版本的 Microsoft.SharePoint.Portal DLL。要么是拼写错误,要么就是问题所在(这意味着如果您使用的是 SP2010,则应该让代码加载 14.0.0.0 版本的 Microsoft.SharePoint.Portal DLL。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文