确定 SharePoint Webpart for XML 中的属性名称 [英] Determine the property name in a SharePoint Webpart for XML

查看:42
本文介绍了确定 SharePoint Webpart for XML 中的属性名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用由非附属第三方制作的自定义 Web 部件.我创建了一个功能,可以将此 webpart 添加到页面.它工作正常,除了我无法弄清楚需要定义的特定属性的名称.我尝试了与工具窗格视图上的显示名称相匹配的明显名称,在显示名称前面添加了公司名称,以及许多类似的排列.所有这些都无济于事.我更愿意将该属性包含在该功能中,因为这将是未来跨多个站点部署所必需的.每次手动配置它对我的客户来说会很痛苦.

I'm employing a custom webpart that is made by an unaffiliated third party. I've created a feature which adds this webpart to a page. It's working mostly fine, except that I can't figure out the name of a specific property that needs to be defined. I tried obvious ones that match the display name on the tool pane view, adding the company's name in front of said display name, and many similar permutations. All of which to no avail. I would much prefer to include the property to the feature, as this will be necessary to deploy across multiple sites in the future. Manually configuring it every time will be a pain for my client.

简短而明显的答案是询问第三方".这可能有效,特别是对于这个特定的(它是一个 CodePlex webpart,作者在上周发表了评论).但是我对以前的第三方解决方案的体验并不理想,通常甚至没有得到回应,直到三周后他们问我是否仍然喜欢他们的产品.因此,由于这并不总是获取这些信息的可靠方法,我认为最好的选择是找到一种方法来找出 webpart 中的属性名称,我不仅可以使用这个特定的,而且可以在所有未来的情况.

The short, obvious answer is "Ask the third party". This can potentially work, particularly for this specific one (it is a CodePlex webpart and the author has posted a comment as recent as last week). But my experience with previous third party solutions has been less than optimal, usually even getting no response until they ask me three weeks later if I still like their product. So, since this is not always a reliable method to obtain this information, I was thinking the best option is to find out a way to figure out the name of properties in a webpart that I can use not just with this particular one, but in all future situations.

我确实查看了这个较早的问题它解决了一个类似的主题.但是,我无权访问 webpart 的类,因此我无法在代码中找到方便的属性进行修改.或者,至少,如果我确实可以以某种方式访问​​它,我当然不知道它.

I did check out this earlier question which addresses a similar topic. However, I don't have access to the class for the webpart so I can't just find a convenient property in the code to modify. Or, at least, if I do have access to it in some fashion, I'm certainly unaware of it.

先谢谢你!

推荐答案

据我所知,您正在尝试设置某个 webpart 属性,而您不知道其对应的 XML 属性名称.

From what I understand, you are trying to set a certain webpart property for which you do not know the corresponding XML attribute name.

您是否尝试导出 Web 部件?一种可能的检查可能是尝试导出 webpart 以查看 webpart XML 中出现的属性.如果它是一个公共属性,则 webpart XML 可能已经定义了没有值的属性,例如

Did you try to export the web part? One possible check might be to try to export the webpart to see what properties come up in the webpart XML. If it is a common property, chances are the webpart XML will have that property already defined with no value e.g.

<data>
   <properties>
     <property name="Your property Name" type="yourType"></property>
   <properties>
</data>

要导出 webpart,请转到编辑页面"模式,单击 webpart 上的向下箭头并选择导出".

To export the webpart, go to Edit Page mode, click the down arrow on the webpart and choose Export.

另外,如果你有一个 dll 中的 webpart 代码,你可以使用反射器打开它并查看代码中设置了哪些属性吗?

Also, if you have the webpart code in a dll, can you use reflector to open it and see what properties are being set in code?

希望这会有所帮助.

这篇关于确定 SharePoint Webpart for XML 中的属性名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆