使用PowerShell查找有效的DelegateControl信息 [英] Find information about effective DelegateControl with PowerShell
问题描述
我使用DelegateControls来处理自定义SiteMapProvider。我在uls日志中收到此错误:
I am using DelegateControls to work with custom SiteMapProvider. And i get this error in uls log:
"'V4QuickLaunchMenu'的DataSourceID必须是IHierarchicalDataSource类型的控件的ID。"
"The DataSourceID of 'V4QuickLaunchMenu' must be the ID of a control of type IHierarchicalDataSource."
任何人都可以提供PowerShell来通过反射调用那些SharePoint非公共方法来查找有关使用ControlID QuickLaunchDataSource的当前有效控件的信息吗?
Can anybody provide PowerShell to call those SharePoint non-public method with reflection to find out information about current effective Control with ControlID QuickLaunchDataSource?
我在DelegateControl.CreateChildControlsInternal中看到( ),有以下有用的方法:
I see in DelegateControl.CreateChildControlsInternal(), there are following helpful methods:
SPElementProvider availableProvider = SPElementProvider.GetAvailableProvider();
SPElementProvider availableProvider = SPElementProvider.GetAvailableProvider();
SPControlElement sPControlElement = availableProvider.QueryForTopControlElement(contextWeb,this。范围,this.ControlId);
SPControlElement sPControlElement = availableProvider.QueryForTopControlElement(contextWeb, this.Scope, this.ControlId);
List< SPControlElement> allControlElements = this.GetAllControlElements(web);
List<SPControlElement> allControlElements = this.GetAllControlElements(web);
但是,它们都是非公开的。
However, they are all non-public.
$
更新:实际上,我得到的错误消息不是根本原因,结果是我的自定义sitemapprovider的构造函数中有错误。 SharePoint似乎正在为Web.Config中配置的SiteMapProviders创建实例。我的自定义代码抛出异常
,但ULS中记录的错误看起来像DelegateControl" QuickLaunchDataSource "。
但无论如何,如果有人可以提供,我在这篇文章中要求的PowerShell在许多情况下仍然会非常有用。
But anyway, the PowerShell i requested in this post will be still very helpful in many situations if someone can provide.
推荐答案
<嗨GuYuming,
Hi GuYuming,
感谢您分享此问题的更新,以下是PowerShell脚本,它将访问Delegate Control供您参考:
Thanks for sharing the Update of this issue and here is the PowerShell script which will access Delegate Control for your reference:
param(
[string]
Url,
[string]
Url, [string]
ControlId,
[开关]
ControlId, [switch]
这篇关于使用PowerShell查找有效的DelegateControl信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!