如何允许用户将 Sharepoint Web 部件从一个页面复制到另一个页面?
我需要允许用户将现有的 Web 部件及其配置自动复制到另一个页面。另一个页面将是存在于其“我的网站”区域下的页面。
其想法是允许用户查看仪表板,其中多个 Web 部件显示信息,并让用户选择想要在自己的个人 MySite 页面上显示的单个 Web 部件。
我想通过在 Web 部件上提供交互式按钮/菜单选项来触发一些 .Net 代码来实现此目的,然后这些代码将在目标页面上复制 Web 部件。
这可能吗?或者其他人对此主题有任何其他观点/想法吗?
谢谢,
布莱恩。
I have a requirement to allow users to copy an existing webpart as well as its configuration automatically to another page. The other page will be a page which exists under their MySites area.
The idea is to allow a user to view a dashboard, with multiple webparts showing information, and for them to select an individual webpart that they would like to display on their own personal MySite page.
I would like to achieve this by providing an interactive button / menu option on the webpart to trigger some .Net code which will then duplicate the webpart on the destination page.
Is this possible or has anyone else got any alternative views / ideas on the subject?
Thanks,
Brian.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
首先,这取决于正在复制的相关 Web 部件是否是自定义 Web 部件?如果是,只需使用您需要的所有行为对 Web 部件进行基类化即可。
但是,如果它们是仅以某种方式配置的默认 Web 部件,那么首先想到的选项就是仅创建一个自定义可重用 Web 部件。此 Web 部件可以添加到任何页面。公开属性来设置目标页面,无论它是从带有固定选项(例如“您的我的网站”或网址)的下拉列表驱动的。让 Web 部件使用 SharePoint 对象模型来查询当前页面上的所有 Web 部件,并将它们呈现出来以供选择。提供一个按钮并处理将所选 Web 部件复制到目标页面的操作。
再次,考虑可重复使用。您永远不知道,您可能希望将相同的行为转储到 SharePoint 中的另一个区域并具有类似的行为。
Firstly it depends on whether the web parts in question that are being copied are custom web parts? If they are, just base class the web parts with all the behaviour you need.
However if they are default web parts just configured a certain way, then the options that spring to mind are creating just one custom reusable web part. This web part can be added to any page. Expose properties to set the destination page, be it driven from a drop down with fixed options like "your my site" or a url. The have the web part use the SharePoint object model to query for all webparts on the current page, render these out for selection. Provide a button and handle the copying of the selected web part to the destination page.
Again, think reusable. You never know, you may wish to dump this same beahviour onto another area in SharePoint and have a similar behaviour.