How to Export & Import Web Parts in SharePoint(转)

原文:http://community.bamboosolutions.com/blogs/sharepoint_blank/archive/2009/01/08/how-to-export-amp-import-web-parts-in-sharepoint.aspx

 

While blogging my continuing investigation into whether or not it's possible to deploy a My Site Web Part into a Team Site yesterday, I promised a step-by-step look at my latest nugget of SharePoint learning.  That nugget?  How to export a Web Part from one site and import it to another site within a site collection.  So as to continue the learning process, I aim to answer another question that has since occurred to me regarding the exporting/importing of Web Parts, and that question is: When you export/import a Web Part that's already been configured, do all of your existing settings come along for the ride?  I'll put my cards on the table and say outright that I'm assuming the answer to this question is yes, so let's find out together, shall we?

For the purpose of this experiment, I'm going to use the World Clock & Weather Web Part that's on my My Site (since, as a result of my ongoing investigation, I already know that I won't be able to use any of the My Site-specific Web Parts), and I'll begin by selecting the Export... item from the dropdown menu in the upper right of that Web Part:

Clicking that Export... button brings up the following message:

After choosing the Save option, I'll choose where to download the DWP file (desktop probably being the handiest option since once I've imported it, I'm just going to delete the file anyway.  Note:  In some cases, the name of the Web Part may be different than the name of the DWP file, so don't be alarmed) on the resulting screen.

Once I've saved the World Clock & Weather Web Part DWP file to my desktop, I'm going to navigate to another site in our collection, the site where I want to import the Web Part.  I'll be heading to our team's site because, well, I have edit rights there.  Once I've chosen the page to which I want to import the Web Part, I'm going to first select Edit Page from the Site Actions dropdown menu on that page and then, once in Edit Mode, I'll click an Add a Web Part button on the page.  Clicking that button will bring up the Add Web Parts popup, and here I'll choose the Advanced Web Part gallery and options hyperlink at the bottom of the page.  Doing so will render the Web Part task pane at the right of the page in Edit Mode, and clicking the dropdown button in the Browse section of that pane will provide the Import option I seek:

Clicking the Import option will refresh the task pane with the Import view, in which I'll simply browse to the DWP file on my desktop and then click Upload:

Once the upload is complete, the task pane will refresh with a new section, confirming the Uploaded Web Part and providing placement options for its importation onto the page:

Just as you would expect, after choosing the placement and then clicking the Import button will place the imported Web Part on the page in the desired location ... and guess what?  The version of the Web Part which gets imported does indeed retain all of the configuration options from its original location.  Sweet!

posted @ 2010-03-10 17:02  玛雅人  阅读(507)  评论(0编辑  收藏  举报