Making Sense of the SharePoint World

Mar-262009

Something Old In Something New

Classic

Using legacy FrontPage functionality in SharePoint and SharePoint Designer to create a file "drop box".

SharePoint is a great tool for information sharing. Document libraries allow your users to upload and collaborate on documents of all sorts. Sometimes, though, you don't want to do things quite the way SharePoint does it.

Does this sound familiar?

"I want a place where users can upload a file, but I don't want them to see what everyone else has uploaded."

Your first thought might be no problem, I'll just set up a document library, but what about that bit about seeing what everyone else has uploaded? Now we're getting a bit messy. Document libraries don't have an "only their own" security option.

And what if this is supposed to be a "drop only" zone, such that they aren't even supposed to get back at their own files? (This is a more common request than you might think). Again, very difficult with the standard SharePoint document libraries. Savvy users can figure out how to get to their files based on the address of the forms folder.

While there are many ways to get around these issues, most of them involve a lot of work customizing the target library and its forms. Fortunately, there are some old, but little known, tools in SharePoint and SharePoint Designer that can make short work of the problem.

It's In There...

You may not realize this (unless you've been around a while, or read the Appendix to my book), but SharePoint is a descendent (at least conceptually) of the FrontPage Server Extensions (FPSE). Although there has been a lot of enhancement since then, many of the functions of these extensions still exist within SharePoint in a compatible way. SharePoint Designer, as a descendent of FrontPage, supports this FPSE functionality.

One of the things you may find surprising about the FPSE, is that most of its features are meant to be defined in "static" HTML pages. Specially crafted comments, called WebBots, were used to signal to the server that extra processing was to take place at either save or render time.

For this project, we're going to make use of the FPSE form handler WebBot to let the user select a file and upload it into a hidden document library on your site.

Making it Happen

The first thing you need, of course, is a place to put the files. As stated earlier, the natural target is a document library. So, let's create a library called DropBox.

Note: Most of these steps will take place in SharePoint Designer.

From the File menu, select New, SharePoint Content:

image

Select Document Library, and enter a name, such as DropBox. Click OK to create the library

image

Once the library is created, right-click it and choose Properties. Check the box "Hide from browsers", so that the library doesn't appear in the Quick Launch or All Site Content lists. Set the Use version history to Major Versions. (You want versioning enabled so you don't lose anything if users upload files that have the same name.) Since there won't be a default document type for this library, you can also uncheck the "Use a template" option. Click OK once the settings are correct.

image 

Note: There is one library setting you may wish to make in the browser, to block the library from appearing in SharePoint Search results. Under the Document Library Settings, Advanced Settings, set the Search option to "no".

Once you have created your target library, you create HTML pages to use for your upload form and confirmation page.

From the File menu, select New ->HTML. This will create an html file in the design surface.

From the Toolbox task pane, drag an Input (File) control onto your page.

image

This will automatically create a Form element to surround it.

Drag an Input (Submit) button into the new form as well.

image

I'm using the SharePoint Designer split-view of my page to show both the code and visual layout. Now we need to make a slight change to the automatically created Form element. To do this, we'll click in the code area to place the cursor after the post statement. When you hit space, you will be presented with Intellisense options for parameters you can add to the form tag. In this case, we want to add an "enctype" parameter, and set it to "multipart/form-data", as shown below.

image

image

Without this change, the form will not be able to handle the binary file information we want to transfer. I'm also going to rename the Submit button to say "Upload" by double-clicking it and changing the Value/label field, and also place it on a new line.

image

This results in a form that looks like the image below in the editor:

image

Now that my form has all of the information I want, I'm going to tell it where to place the files. Right-click the form, and select Form Properties. In the Form Properties dialog, select "Send to (Requires FrontPage Server Extensions)". Enter "_private/dropbox.xml" into the File name field. This is not where the files go. Rather, it will be a log of all of the forms that have been submitted. If you add other fields to your form, their values would also be stored in this file.

image

Now, we click the "Options" button, and click the File Upload tab. Click the Browse button and select our DropBox library. Click OK to implement the changes. (Don't worry about the other fields or tabs for right now.)

image

The first time you save your form, you may also get an alert telling you that files not saved in _private may be visible to others.

Save the page in the root of your site as "dropbox.htm" (you can move it later).

At this point, you can test the basic functionality of your form. Preview the page in your browser, and try uploading a file. You should see a confirmation page similar to the following:

image

And if you open the DropBox library in SharePoint Designer, you will see the file there as well (you may need to press the F5 key to referesh the view)

image

The only problem is that confirmation form - you've just told your user where you put the file.

Creating a Confirmation Page

You can also create a custom confirmation page for your form. Again, this starts as a simple, HTML page, so select File -> New -> HTML.

From the Insert menu, select "Web Component". This will summon a dialog box, in which you will select Advancved Controls as the component type, and Confirmation Field for the actual control:

image

Click Finish. You will be asked for the name of the control to use. Type Submit1 and click OK. (Submit1 is the name of the upload button in our form.)

Enter the following text after the form field:

complete!

Thank you for your submission. Click here to return to the form.

Highilight "Click here", and press <ctrl>+k. In the insert hyperlink dialog, select the dropbox.htm file. You should end up with something that looks approximately like:

image

Save the file as "DropConfirm.htm".

Meanwhile, back on the dropbox.htm page, right-click on the form and select Form Properties. Click the Options button, and select the Confirmation Page tab. Click Browse, and select the DropConfirm.htm page you created above.

image

Click OK to save the change, and also on the Properties dialog. Save the dropbox.htm page, and preview it in the browser. Upload a file, and ensure that your new confirmation page is displayed:

image

Using Your Dropbox

Once your form and confirmation page are working to your liking, you need to make them available to your users. The best way to do this is to use a "Page Viewer" web part. This web part allows you to display virtually any page within the context of a SharePoint web part page. We're going to use the standard SharePoint web interface to add this part.

To add the web part, Navigate to the page where you want the form to appear, and select Edit Page from the Site Actions menu. Click the Add a Web Part link in the zone you want. From the dialog, select Page Viewer Web Part. (It will usually be in the Miscellaneous section). And click the Add button.

image

This will add the part to the top of the zone you selected. Click the "open the tool pane" link.

image

That will open the Page Viewer Web Part's task pane:

image

Enter the URL path to your dropbox form in the Link field. I suggest using a "root relative" address (i.e. preceding backslash, but without the " http://server ").

In this case, I also changed the web part title, and set fixed height and width settings for the web part in order to prevent scrollbars (these numbers may vary on your site). Click OK to save your changes, and click the Exit Edit Mode link to see your final page. (You may need to check-in the page on MOSS Publishing sites.)

image

Summary

There you have it! A simple way to give give your users an "upload only" dropbox. You can easily change the destination location for the files, without needing to make any changes to the underlying SharePoint document libraries or their associated forms.

While this example only provided a simple form, you can enhance it with more text, or additional fields for the log file. You can, of course, format the text any way you like, or even make it a stand-alone page, copying all of the chrome from your site (not a trivial task, but possible.)

Until next time, Happy Dropping!


Mar-132009

Introduction to "Professional SharePoint Designer 2007"

clip_image001

Note: This article is also posted on EndUserSharePoint.com

Hi Everyone! One of the things everyone likes to do while they're browsing for books in the store is read the covers and the introductions. While the listings for my book on the various sites include the back-cover description, and Wrox has posted the Table of Contents and Chapter 1 as PDF, the introduction hasn't been posted anywhere. I thought you might like to read it, so here it is - an Introduction excerpt from Professional Microsoft Office SharePoint Designer 2007

 

INTRODUCTION

"Can you make it look less like SharePoint?"

Such a simple question, and yet, like someone opening the lid to Pandora's Box, the customer asking it can release a whole range of troubles into the life of a web designer. The latest release of Microsoft SharePoint products has taken the world by storm. Faster than anyone could have foreseen, businesses large and small have discovered that SharePoint addresses a range of needs, and have rushed to jump on the bandwagon.

SharePoint is not merely a web server. It is a large and complex application, with many moving parts. Some of them are easy to customize; others require a bit more finesse. Tools and guidance for that customization are few and far between. Fortunately for you, SharePoint Designer is such a tool, and this book provides the guidance. Together, they enable you to look your customer in the eye and answer with a resounding: "Yes!"

Yet SharePoint Designer can do far more than customize SharePoint sites. It is a fully-featured web design tool in its own right, with excellent support for many industry standards, as well as backward compatibility with a few nonstandard capabilities.

Who This Book Is For

This book is for anyone who has been asked the opening question. You may be an experienced web designer or a web application developer who has never used SharePoint. You may be a system administrator who needs to tweak a few things to match an existing standard. Perhaps you are a business analyst looking for ways to integrate some CRM information into the company's home page. All of you will find something useful here.

If your familiarity with SharePoint is limited, chapters 2, 3, and 4 will be indispensable for you. They cover the key features of SharePoint, and how they are viewed from the user's, administrator's, and web designer's perspectives, respectively.

This book is also for people upgrading from Microsoft FrontPage. SharePoint Designer is one of two direct successors to FrontPage. As a result, FrontPage users will find much that is familiar, as well as many things that have changed. In general, you will find that while you can edit existing sites that use legacy features, SharePoint Designer's function layout encourages a much more standards-compliant way to design new sites and content.

This book assumes you have a more than passing familiarity with designing applications for the web. A basic knowledge of JavaScript is assumed, as is an understanding of HTML tags. Some allowance is made for the rise of certain technologies in recent years. A few chapters deal with CSS, XML, and XSL, and a short introduction to each is provided where appropriate.

The book also assumes a certain willingness to explore. Although all of the core functions, menus, and toolbars of SharePoint Designer are described, this is not a Bible that explains each and every menu item and dialog tick in excruciating detail. If a program feature offers several options, a representative few are described, and one may be used in an example.

The book assumes you are familiar with basic Windows operations and applications. Where functions are common in many applications, they probably are not discussed at all. (You are shown where to find the Formatting toolbar, for instance, but your familiarity with the icons and meanings of Bold, Center, and the various bulleting options is assumed.) It’s also assumed that you know how to point, click, cut, copy, and paste.

The later chapters move out of SharePoint Designer and into Visual Studio. They cover creating extensions to SharePoint, SharePoint Designer, or both. Examples are provided in both C# and Visual Basic .NET. Although the source is discussed and/or documented in the text, no attempt is made to teach the languages themselves, so proficiency in one of these languages is desirable. Many readers may consider these chapters optional, although system administrators should at least pay attention to chapter 18.

What This Book Covers

This book covers Microsoft Office SharePoint Designer 2007, with an emphasis on using it to customize web sites based on Microsoft SharePoint products and technologies. You will learn about Master Pages, Themes, and various Web Parts that enable you to create powerful applications with little or no code.

A short overview of SharePoint is provided to ensure that you are not flying blind when you customize SharePoint sites. At the other end of the scale, you are taken outside the box with chapters that teach you how to use Visual Studio and other tools to extend the capabilities available in both SharePoint and SharePoint Designer.

Aspects of SharePoint Designer beyond SharePoint customization are not ignored, however. You will find sections that cover the basic web-editing features, generic application of the CSS editor, and site administration functions provided by SharePoint Designer. Many elements, such as data views, while described in the SharePoint context, are also relevant without a SharePoint environment.

How This Book Is Structured

This book is made up of 18 chapters, in five parts. Each part brings together related tasks and content. Part I is fundamental to everything else, but the other parts do not necessarily need to be read in a particular order. They are, however, largely progressive in their complexity.

Part I, “The Basics,” provides an overview of SharePoint Designer, SharePoint technology, and their relationship to one another.

Part II, “Customizing the SharePoint Look and Feel,” shows how to use SharePoint Designer to customize various aspects of your sites.

Part III, “Applications without Programming,” shows how SharePoint Designer can create many powerful applications that in the past would have required considerable programming effort.

Part IV, “Programming on the Client Side,” demonstrates some tools provided by SharePoint and SharePoint Designer to enable even more custom interactivity.

Part V, “Beyond SharePoint Designer,” takes you far past the built-in capabilities of SharePoint Designer with extensions, add-ins, migration, and conversion tools.

Web design is an intrinsically visual process, web designers tend to be visual learners, and SharePoint Designer is a visual tool. This book takes that into account by including a relatively high proportion of screenshots. There are also step-by-step exercises where appropriate. Finally, it wouldn't be a Wrox Professional book without sample code, and that is here in abundance. In this case, "code" is interpreted liberally to include markup, CSS, and scripting, in addition to compiled source.

What You Need to Use This Book

While you can learn much from this book simply by reading, to follow along with the exercises and step-by-step instructions, it will be helpful to have a few things. Most important, of course, is a copy of SharePoint Designer 2007. You should also have access to a SharePoint environment that you can use without adversely impacting production sites.

Certain examples make use of Web Parts that are only included with editions of Microsoft Office SharePoint Server 2007 or Microsoft Search Server 2008. The Express Edition of Search Server (MSSX) is available as a free download from Microsoft, and is a sufficient version of SharePoint to perform all of the exercises and examples in this book, except for those in chapter 8.

Chapter 8 describes Publishing layouts and content management. These are features exclusive to Microsoft Office SharePoint Server 2007. You will need access to this if you wish to follow the examples in that chapter.

To compile the example programs in Part V, you need Visual Studio 2005 or Visual Studio 2008, Standard Edition or higher. You also need to download the following add-ons from the Microsoft MSDN site:

· The Windows SharePoint Services 3.0 Software Development Kit (WSS SDK)

· The Microsoft Office SharePoint Server 2007 Software Development Kit (MOSS SDK)

· Visual Studio Tools for Office (VSTO)

· Visual Studio Extensions for Windows SharePoint Services (VSeWSS)

The SharePoint Designer add-in example in chapter 17 requires the SharePoint Designer 2007 Add-In project template from the Microsoft CodePlex site.

Most SharePoint designers and developers find it convenient to create a sandbox development environment containing all of the tools listed here (and other favorite development utilities) on a virtual machine (VM). All versions of SharePoint require Windows Server 2003 or Windows Server 2008, with at least 1GB of RAM to install successfully (2GB or more of RAM is recommended).

Related Products

SharePoint Designer is not the only Microsoft product created for manipulating web pages. It is closely related to Microsoft Expression Web, which sprang from the same FrontPage roots. In addition, Visual Studio is a useful tool for web designers of all stripes.

SharePoint Designer Compared to Expression Web

As with the mythical Hydra, who grows more than one head if the first is cut off, the end of FrontPage was the beginning several children. Like SharePoint Designer, Microsoft Expression Web is a direct descendent of Microsoft FrontPage. In fact, from a basic page-editing standpoint, SharePoint Designer and Expression Web appear virtually identical.

Scratch the surface, however, and the differences become clear. Nothing says it better than the dialog shown in Figure 1, which you get when you try to open a SharePoint-based site in Expression Web. Expression Web has no capability to work on a SharePoint site.

clip_image003

Figure I-1

SharePoint Designer, on the other hand, happily opens web sites created with most versions of SharePoint. In addition, SharePoint Designer offers more complete support for sites created using the FrontPage Server Extensions.

So, why use Expression Web? If you don’t need to work with SharePoint, Expression Web provides an excellent set of tools for creating standards-based web sites. It integrates with Visual Studio, supports PHP (which SharePoint Designer does not), and includes several web site templates that are not available with SharePoint Designer.

SharePoint Designer Compared to Visual Studio

The other tool you might consider for working with SharePoint is Visual Studio. In fact, there are certain things that cannot be done with SharePoint Designer. Some of these tasks are described in Part V, “Beyond SharePoint Designer.” The key is to remember that SharePoint Designer is generally used to customize SharePoint sites and manipulate existing features, whereas Visual Studio is used to develop new SharePoint functionality.

clip_image004Professional Microsoft Office SharePoint Designer 2007
Woodrow W. Windischman, Bryan Phillips, Asif Rehmani
ISBN: 978-0-470-28761-3


Published: Mar-13-09 | 0 Comments | 0 Links to this post
Tagged as: SharePoint Designer, Training

Mar-52009

Binary Free SharePoint Twitter Search Web Part

Binoculars

No Assembly (or C#, or VB) Required

Searching Twitter from SharePoint has become all the rage since I originally posted my Twitter Search Federation articles (Part 1, Part 2). Federation is great if you have Search Server, or the Infrastructure Updates. But what if you are only using WSS? Or what if you just want to drop a Twitter search into any old SharePoint page, rather than a full Results page? And more critical - what if you don't have direct access to the SharePoint server in order to install binary web part and feature - with or without a Solution Package (WSP)?

Well, buried in Part 2 of my article was the the solution. A Data View Web Part (DVWP) that displays the results of a twitter search. In the original article, that DVWP was just an interim step on the way to Federation. For this article, a form of that web part is the actual goal. So, I'm going to start by re-using the DVWP section of the Federation article - with a tweak or two :). But then, I'll also show you how do two very important things - connect the web part to an input form (or any other web part), and export it for use on other SharePoint sites.

Note: You can find a link to download the Twitter Search Results Web Part at the end if this article.

A Data View Refresher

The Data View Web Part is a way to display information from virtually any source within SharePoint. Data Views are created in SharePoint Designer, in association with another feature called the Data Source Library. This is not to be confused with the "Business Data Catalog", or BDC. While both the Data Source Library and the BDC deal with presenting data from external sources within SharePoint, the BDC is a part of MOSS Enterprise, and allows a much deeper integration of the data with various aspects of SharePoint. The Data Source Library, on the other hand, is available in all editions of SharePoint - from WSS on up - and is primarily used to generate Data View/Data Form Web Parts.

Data Views and the Data Source Library are a very powerful combination - so much so that almost two whole chapters of my book are devoted to them. Obviously, I can't go into that kind of detail here, but while this particular example is fairly simple, it covers a lot of ground.

The link between Federation and Data Views is pretty close. In fact, prior to Search Server or the Infrastructure Updates, you could use a Data View to achieve very similar results. We're going to take advantage of this by building the look we want in a Data View, then transferring it into the Federated Location definition.

Creating a Data View

Before we can create a Data View, we need create a new item in the Data Source Library for our Atom feed.

To do this, Select "Manage Data Sources..." from the Data View menu in SharePoint Designer to summon the Data Source Library task pane. Atom and RSS feeds fall into the category of "Server-side Scripts" that return XML, so expand the Server-side Scripts section and click "Connect to a script or RSS Feed." You will see the dialog below. Fill in the URL with the same Twitter Atom query we have been using: http://search.twitter.com/search.atom?q=sharepoint (See Part 1 of the original article for details on how this was derived.)

image

The query parameter (q) will automatically be passed into the list as soon as you change the focus from the URL field. "SharePoint" will become the default parameter value, and give us something to see as we customize the look. If you are following along, you can replace "SharePoint" with any default query term that might be appropriate to your environment. Make sure the Runtime Parameter box is checked, otherwise you can't change the query later.

Now that we have the Data Source, we need a place to put it. This can be any web part page. While you can use the results page if you feel so inclined, because we aren't going to be using the Data View directly, it doesn't need to be.

Once you have a web part page open, select a Web Part Zone, and then pick "Insert Data View..." from the Data View menu. The Data Source you created above will have a drop-down menu associated with it. Select "Show Data".

You will see the Data Source Details task pane, with the structure of the Twitter Atom feed displayed.

image

I've maximized my task pane for this screen shot in order to show you how the SharePoint Designer data source displays the entire structure of the feed. Notice the folders and item scrolls for the various elements. The Twitter Atom feed is a "hierarchical" data source. This means that the data has nested, potentially (and in this case, actually) repeating, elements, which in turn may have their own nested elements.

For now, the primary entity we are interested in is the "Entry" folder. Look at the screen shot to the right. Highlight the elements in the "Entry" folder as shown, and select "Multiple Item View" from the "Insert Selected Fields as..." menu. (Yes, I know. It looks like a button, but trust me - it's a menu!)

A table will be inserted into the web part. That's got most of the information we want, but it isn't terribly pretty. So, let's fix it up!

The first column contains the "href" entity. Ironically, even though there is a separate entity for the Author, one of the two links listed for each user is the Author's avatar. The other is a link to the Twitter URL of the tweet itself. For our results, we really only want the avatar, so we're going to do two things - Change the display to show the image instead of the URL, and hide the other URL.

To change to an image view, click one of the URLs in the href column. To the right will be a little box with a chevron in it:

image

When you click it, you will have choices to modify the current field. Select Picture.

image

You will get a warning that URLs and Pictures can be dangerous. We know that, so click Yes.

The changes you make here will affect all of the items of that series. (You probably noticed that they were all highlighted in a different color when you clicked on any one of them.)

Once you have done that, to suppress the other image (which will show as a "broken" picture), Right-click the broken link and select "Conditional Formatting". In the Conditional Formatting task pane, select "Show Content" from the "Create" menu (another one of those "buttony" menus). In the Condition Criteria box, set the conditions like this:

image

The broken link will go away.

Next, we want to merge the rest of the cells in the row. This is just like any other table action - highlight the data cells (not the labels) for content, updated, name, and uri. Right-click, and select "Modify/Merge Cells". Now we're cooking! Just a couple more tweaks, and it will be there.

Select the tweet content text, and change its format to Rich Text (just like changing the image format above).

Select the date, and format it to your regional liking.

Notice that we have a link to the Author, the Author's name, and the Author's avatar. Wouldn't it be great to have the name and the avatar actually link to the Author's page? Well, we can. If you click the chevron by the link, you will see that the field being displayed is called "ddw1:author/ddw1:uri". For the text, change the format to Hyperlink, you will see the following dialog. You can use the "fx" icons to select the fields you wish to use in the hyperlink, or enter the values manually. In either case, you want the "Text to display" and "Address" fields to be set as shown:

image

Setting the link on the picture is easy, too. Just right-click the image, and select "Hyperlink" from the context menu. Set the address to the same token as you used above. Now you can delete the field that shows the text of the author link.

You should now have a web part that looks a lot more like what you would expect from a Twitter search:

image

Pretty good, but I'm still not satisfied. :)

Notice the chevron icon in the upper-right corner of the web part.

If you click it, you will summon the "Common Data View Tasks" menu:

image

Click Data View Properties. You will get this dialog:

image

Click "Show view header" and "Show view footer", then click the "Paging" tab.

Click "Limit the total number of items displayed to:" and enter a reasonable number for a search results page. (I picked 5). Click OK.

Display the Data Source Details task pane, and drag the first title field available into the newly created header. Click in the footer, and delete the Item Count. In the "link" group (above the "title" field you just used), make sure item 1 (rel = "alternate") is selected. Highlight the "href" and select "Item(s)" from the Insert Selected Field menu. Change its format to a Hyperlink. Leave the Address as-is, but change the Text to Display to "More Results..."

I'm going to delete the field name row, rearrange the fields slightly, and also apply the style "ms-searchChannelTitle" to the Header cell. This results in a part that looks like this:

image

Now I'll make one more change to this web part to allow it to respond to a URL query string. From the Common Data View Tasks menu, select Parameters. You should see this dialog, displaying the "q" parameter that got created when we built the Data Source:

image

From the Parameter Source menu, select Query String. This will add a field for you to enter the name of the URL parameter you will be passing. The standard for SharePoint Search keyword parameters is "k", so I suggest using this (without the quotes, of course). This allows you to use this web part on a standard SharePoint results page and have it respond appropriately. But you can also then use the k parameter in the query string of any SharePoint page you drop the part on!

Your Twitter Search Results web part is done! You can save the page and close SharePoint Designer.

The Twitter Search Results Web Part in Action!

When you display the page on which you created the Twitter Search Results web part, you will see the default result set:

image

To show that the URL Query string works, append a "?k=twitter" to the URL (again, no quotes), and hit the Enter key. The results will change to Tweets containing the word Twitter:

image

Notice also how the search form recognized the "k" parameter, and set it as the default keyword for an internal Sharepoint search...

Now that we know the part is working, delete the k parameter from the address bar and hit Enter to return to the default page. We need to do this because the query string parameter will override the web part connection we're going to be making. (You might want to keep that in mind, as there may be times you find that behavior useful in your own data views...)

Let's insert a "form" web part on the page. From Site Actions, select Edit Page. In one of your Web Part zones, click the Add a Web Part link, and select Form Web Part from the Miscellaneous section, and click the Add button:

image

By default, this form will have a text box, and a "Go" button, and will be called "Form Web Part". On your site, you will probably want to set the web part properties to give it a different label, such as "Twitter Search". For purposes of this article, I'm going move directly on to setting up the connection.

From the edit menu on the part you just inserted, select Connections.

image

From the fly-out submenu, select Provide Form Values To, and select the Twitter Results web part. You will get this dialog:

image

Select Get Parameters From, and click the "Configure" button. The dialog will then ask for the Consumer Field Name. Select "q" (the parameter name), and click the "Finish" button.

image

You can then also exit Edit mode on your page.

Now just enter a term into your form, and click "Go". You will get Twitter Search results for the term you selected!

image

You don't need to use a form for the web part connection. You can connect to almost any web part in SharePoint to get query parameters. For example, you could connect to a client list and use the company name as the search term. You could then just click on each client's record to see their Twitter buzz.

Exporting and Importing the Twitter Results Web Part

Important: Remove the web part connection created in the previous exercise before exporting! 

One of the great things about the Data Views you create in SharePoint Designer is that you can easily export them for use on virtually any SharePoint site that has access to the data used to define it. To do this, Use the little arrow in the top right corner to summon the web part menu, and select Export:

image

A standard download box will appear, allowing you to save the file to your local machine. In our case, the part will be called Twitter_Results.webpart. ".webpart" is one of two extensions you might see when exporting SharePoint web parts. (The other is ".DWP")

So, what do you do with the file once you have it? You import it back into SharePoint!. As mentioned earlier, it doesn't need to go on the same site - or in this case, even the same server! As long as the server you are installing the part on has access to Twitter, you can use this part.

There are two ways to import the part:

  1. Directly importing onto a page
  2. Adding it to the Web Part Gallery

To import it onto a page, start the same way as always: From Site Actions, pick Edit Page. Then click Add a Web Part over a Web Part zone. However, this time, you need to click the link on the bottom of the window: "Advanced Web Part gallery and options"

image

This will close the dialog and open the Add Web Parts task pane. At the top of the task pane is a menu. Select Import from the menu: image

This changes the task pane to Import mode. From here, you can either type the path to the .webpart file, or use the standard Windows file dialog to browse for it:

image

Click Upload, and the part will appear on a list below the form. You can then drag it into the Web Part zone of your choice.

The down side of this method, is that you have to re-import the web part for every page on which you want it to appear. Fortunately, you can make it available to any page in your site by adding it to the Web Parts Gallery.

To access the Web Parts gallery: From the Site Actions menu, select Site Settings. On the Site Settings page, you will see the list of Galleries. Click the "Web Parts" link.

image

Essentially the Web Parts gallery works just like any other document library in SharePoint:

image

To add the web part, click Upload, and browse to the web part file. After you upload it, you can enter a full description, and determine the context(s) in which the part will be selectable.

image

Click OK to complete the Save process. From then on, your Twitter Results web part will be available from the standard Add Web Parts dialog box:

image

Of course, these techniques apply to almost any Data View or Content Editor Web Parts you create, not just this Twitter Search.

You can Download this part here!