简体   繁体   中英

How can I allow a user to copy a Sharepoint webpart from one page to another page?

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM