Category Archives: Web Part

SharePoint: Create a Snazzy Looking Weather Web Part in 15 Minutes or Less


You may also be interested in: fpweb.net


 

Editor’s note: Contributor Erik Abderhalden is a consultant with Rightpoint. Follow him @erikboderek

When people ask me what’s the weather is like outside, I think of Good Morning Vietnam when Robin Williams asks his fictional weather reporter Roosevelt E. roosevelt what the weather’s like. Roosevelt snaps back, "You got a window? Open it."

When it comes to intranet sites, one of the more frequent requests is the ability to display weather. Not everyone in corporate America has the ability to open a window, nay even sit by a window. Thus a weather widget, or in the case of SharePoint a web part, is utilized to showcase the current temperature and give workers something to look forward to when they leave work or plan their weekend.

If you Google "SharePoint weather web part" you get a slew of solutions and they all have different functionality. What if instead of downloading a web part you could use a content editor web part and some JavaScript, CSS and accomplish the same functionality for free? It’s easy to set up and takes about 15 minutes from start to finish.

In this solution, I’ll be utilizing Zazar’s zWeatherFeed JavaScript and some CSS. zWeatherFeed utilizes Yahoo weather and is easily customizable to meet your requirements.

First, download the zWeatherFeed JavaScript here. If you’re like me and reside in the United States, we don’t use Celsius like the rest of the world, so we need to change the script to use Farenheit instead of Celsius. In your favorite script editing program, open up the script you just downloaded. Do a search for "unit" and replace the value of "c" to "f". The location varies if you downloaded the .min.js or .js file. Here’s what you need to look for:

zweather.min.js
unit:"c"
zweather.js
var defaults = { unit: ‘f’,

Great. Upload the JS to a safe place on your SharePoint site.

Now create a new text file. In the text file we’re going to place our code to call the JavaScript, and set up the HTML formatting for the weather.

The code is as follows. Be sure to update line 3 to reflect the JavaScript’s actual location.



In line 7 of the code are all the zip codes the web part will diplay the weather for. You can use up to 10 zip codes so update the code to be reflect all the zip codes you wish to display. When done, upload the file to your site.

Now you’ll need some styling. First things first, download this image and add it to your SharePoint site. This will be used to toggle between the different weather forecasts and displays at the bottom of the web part.

We’re not doing anything fancy here other than following the instructions about styling the .day and .night classes so the web part’s background will reflect if it’s presently day or night in the currently location. You can add the stylesheet to the page via your prefered MO: another CEWP, in the same text file as the JS, an external stylesheet etc.,

However you place the stylesheet, be sure to update line 53 to reference the image you downloaded in the previous step. If you don’t include the reference, no worries, but you won’t have the nice navigation in the web part because that’s what truly defines this web part as snazzy opposed to all those non-snazzy weather web parts.



Be sure to upload the CSS to your site. Now that the fun stuff is done, it’s just configuring the page. Add a content editor web part to the page and reference the JavaScript in the web part’s content link property. Repeat if applicable for the CSS. And voila! You’re now the proud owner of a snazzy looking weather web part!

2013-11-05-WeatherWebpart-01.png

Chart Web Part in SharePoint 2010


You may also be interested in: fpweb.net


 

Editor’s note: Follow contributor Justin Singer @dynamics_101

What is a Chart Web Part?

SharePoint is web-based collaboration platform. On a SharePoint web page, you can add Web Parts which are customizable web page elements. A Chart Web Part, as the name suggests, is a Web Part that contains a chart. It enables users to visualize numerical data and get business insights such as trends at a glance. And the good news is, adding a Chart Web Part on a SharePoint 2010 site is as easy as a few clicks.

Why should you use a Chart Web Part?

We’ve often heard people say “A picture is worth a thousand words”. With myriads of data collected from business activities, it’s hard to figure out what is really going on by looking at the endless tables and lists. Charts, well designed and configured, can tremendously help you better understand your business and make smarter business decisions.

Where can the Chart Web Part draw data from?

In SharePoint 2010, there are four data sources that can be used with the Chart Web Part:

  1. Another Web Part. Chart Web Part can be connected to another Web Part and display the data stored in there as long as the other Web Part is able to send data.
  2. A SharePoint List. Chart Web Part can be connected to a SharePoint List if it is in the same site collection. (The instructions below show the steps of adding a web part using a SharePoint List.)
  3. A Business Connectivity component. Chart Web Part can display external business data by connecting to a Business Connectivity Services (BCS) component.
  4. An Excel Services file. If the data you need to display is stored in an Excel workbook, you can first publish the file to the SharePoint site using Excel Services, and then connect it to the Chart Web Part.

What are the available chart types?

SharePoint 2010 Chart Web Part offers a variety of types of charts according to your business needs. Here’s a list of 10 of the many chart types that you can choose when adding a Chart Web Part:

  1. Bar Chart— Shows comparisons among categories:
  2. 2013-09-06-ChartWebPart-01.png

  3. Area Chart—Shows cumulated totals and very often the trends over time:
  4. 2013-09-06-ChartWebPart-02.jpg

  5. Line Chart—Shows a series of data points connected by straight line segments, usually over time:
  6. 2013-09-06-ChartWebPart-03.jpg

  7. Point/ Bubble chart—Shows data in 3 dimensions with dots plotted on 2 axis and dot size being the third dimension:
  8. 2013-09-06-ChartWebPart-04.jpg

  9. Financial chart— Shows financial information such as stock price and trading volumes:
  10. 2013-09-06-ChartWebPart-05.jpg

  11. Pie chart— Shows the percentage of each section, compared to the entire pie as a whole:
  12. 2013-09-06-ChartWebPart-06.jpg

  13. Radar chart — Shows comparison of data in multiple dimensions all at once:
  14. 2013-09-06-ChartWebPart-07.jpg

  15. Gantt chart – Commonly used to show project phases and activities:
  16. 2013-09-06-ChartWebPart-08.jpg

  17. BoxPlot Chart—shows data through their five-number summaries (minimum value, lower quartile, median, upper quartile and maximum value):
  18. 2013-09-06-ChartWebPart-09.png

  19. Funnel Chart—Shows values that progressively decrease in proportions:
  20. 2013-09-06-ChartWebPart-10.png

How to create Chart Web Part in SharePoint 2010?

In our demo, we will show you step by step how to create a Chart Web Part and how to connect it to a SharePoint list so the date from the list is displayed:

Step 1: Click on the site where you want to add a Chart Web Part (in our demo it’s the site called SharePoint). Click on Site Actions:

2013-09-06-ChartWebPart-11.jpg

Step 2: From the list of Site Pages, click on the one in which you want to Add the Chart Web Part:

2013-09-06-ChartWebPart-12.jpg

Step 3: Click on Page, from the Ribbon, click Edit to edit the page:

2013-09-06-ChartWebPart-13.jpg

Step 4: In the Editing Tools, click Insert, click Web Part. In the categories menu, click Business Data, in the Web Parts list, click Chart Web Part, and then click on Add

2013-09-06-ChartWebPart-14.png

Step 5: The following graph shows that the Chart Web Part is added, you can click Data & Appearance to configure the Chart Web Part:

2013-09-06-ChartWebPart-15.jpg

Step 6: You’ll see the following 2 options, Customize Your Chart & Connect Chart to Data, click on Connect Chart to Data:

2013-09-06-ChartWebPart-16.jpg

Step 7: This step shows you the four options of data sources: Another Web Part, a List, Business Data Catalog or Excel Services. In our demo, we will choose connect to a List:

2013-09-06-ChartWebPart-17.jpg

Step 8: From the drop down list, choose the site where the list is located:

2013-09-06-ChartWebPart-18.jpg

Step 9: From the drop down list, choose the list you want to connect to, in our case, we will choose (Root) as the site and Revenue by State as the List and then click Next:

2013-09-06-ChartWebPart-19.jpg

Step 10: Select the values from the list that you want to use in the Chart Web Part:

2013-09-06-ChartWebPart-20.jpg

2013-09-06-ChartWebPart-21.jpg

Step 11: This is the last of the four steps in the Data Connection Wizard. In our demo, we will only configure the X and Y field. Click Finish:

2013-09-06-ChartWebPart-22.png

Step 12: Now on our SharePoint homepage, the Chart Web Part is connected to the list Revenue by State

2013-09-06-ChartWebPart-23.jpg

Step 13 (Optional): We can go to the specific List that the Chart Web Part is connected to and edit the data or add new data sets; we’ve edited the value of Ohio and add the revenue value of Arizona:

2013-09-06-ChartWebPart-24.jpg

Notice that any changes we make to the List are reflected on the Chart Web Part when we refresh it:

2013-09-06-ChartWebPart-25.png

Great job! You’ve just created a Chart Web Part and successfully connected it to a List as the data source!

Reference:

[1] http://office.microsoft.com/en-us/sharepoint-server-help/introduction-to-the-chart-web-part-HA101889216.aspx

How to Add a Video to a SharePoint Site


You may also be interested in: fpweb.net


 

Editor’s note: Contributor Alexandru Dionisie is an Internet Professional and Technical Writer. Follow him @AlexDionisie

  • Note 1: To add a video into a SharePoint site using the default SharePoint tools, you need to have an E plan.

  • Note 2: To view a video you need to have Silverlight installed.

  • Note 3: The video must be uploaded in SharePoint.

How to do it

  • Go to Site ActionsSite Settings;

  • In the Site Collection Administration menu go to Site Collection Features;

  • Enable SharePoint Server Publishing Infrastructure feature.

2013-05-21-SharePointAddVideo-01.png

After enabling this feature in the Editing Tools tab – Insert – Media a new command appears: Video and Audio.

If you click on Video and Audio in the active area a video player will be inserted.

This player can then be customized as needed (width, height, name, etc.).

2013-05-21-SharePointAddVideo-02.png

By default you will have three options for inserting a video:

  • Computer;

  • SharePoint;

  • Web.

2013-05-21-SharePointAddVideo-03.png

If you choose to insert a video from SharePoint or Address, that video must be uploaded into a SharePoint library, or on a video sharing website (for the Address option).

The final result is:

2013-05-21-SharePointAddVideo-04.png

SharePoint: Search in XsltListViewWebPart


You may also be interested in: SharePoint-based solutions by B&R Business Solutions


 

Editor’s note: Contributor Dmitry Kozlov is the leader of the SharePoint Forms Designer Team at SharePoint Forms Designer and Co-founder of PlumSail. Follow him @spform

I had the following problem in our project: my customer has a long list with many text fields. I need to give his users a tool for quick navigation in this list, as well as for searching and editing elements. The best solution was a text filter. When a user enters text into it, the list automatically is filtered by all columns as follows:

2013-04-12-SearchXSLT-01.png

First, I added XsltListViewWebPart (XLVWP) with a default view, then I added an input text box with a ‘Search’ button:


<input type="text" name="searchText" />
<button type="submit">Search</button>

I configured a new ParameterBinding element in the XLVWP to bind it with my text box


<ParameterBinding Name="SearchText" Location="Form(searchText)" DefaultValue="" />

In View parameter, I have added following query:


<Query>
  <Where>
    <Or>
      <Or>
        <Contains>
          <FieldRef Name="Title"/>
          <Value Type="Text">{SearchText}</Value>
        </Contains>
        <Contains>
          <FieldRef Name="Author"/>
          <Value Type="Text">{SearchText}</Value>
        </Contains>
      </Or>
      <Contains>
        <FieldRef Name="PostCategory"/>
        <Value Type="Text">{SearchText}</Value>
      </Contains>
    </Or>
  </Where>
  <OrderBy>
    <FieldRef Name="PublishedDate" Ascending="FALSE"/>
  </OrderBy>
</Query>

Now when I enter text into my filter text box and press ‘Search’ button my list is filtered by Title, Author and Category columns. I can see 3 important problems:

<!–[if !supportLists]–>1. <!–[endif]–>the user has to press the ‘Search’ button to start filtering instead of simply entering the text

<!–[if !supportLists]–>2. <!–[endif]–>The user has to wait for page reload

<!–[if !supportLists]–>3. <!–[endif]–> When the user first opens this page the list is empty because the filter is empty.

I started fixing these problems one by one. First I added asynchronous update to my list view. Check ‘Enable Asynchronous Update’ and ‘Show Manual Refresh Button’ in the properties of XLVWP:

2013-04-12-SearchXSLT-02.png

Users have a manual refresh button in the right-hand upper corner of the list:

2013-04-12-SearchXSLT-03.png

When they enter text into the filter text box and press this button, XLVWP is filtered without the page reload. I found a event receiver in IE developer tools:


javascript: __doPostBack('ctl00$m$g_09891d16_ead7_4eb6_9588_3c2eb636c6eactl02','cancel');return false;

I added it to the onkeyup event handler of my filter text box and then removed the ‘Search’ button:

Search:


<input onkeyup="javascript: __doPostBack('ctl00$m$g_09891d16_ead7_4eb6_9588_3c2eb636c6ea$ctl02','cancel');" />

Great, now the list is filtered, without a page update, while the user inputs the text. Ok, but the last problem remains: an empty list when the user first comes to the page. To solve it I used a calculated field in my list: _TitleToFilter with formula: ="###"&Title. Then I added a default value to the binding parameter: ###


<ParameterBinding Name="SearchText" Location="Form(searchText)" DefaultValue="###" />

In the query I replaced Title column with _TitleToFilter:


<Contains>
  <FieldRef Name="_TitleToFilter"/>
  <Value Type="Text">{SearchText}</Value>
</Contains>

Now that the filter is empty, the sequence of three sharps (###) is used as a filter pattern. And all items have this substring in their _TitleToFilter column.

Ok, but a new problem occured: when the user clears the filter text box; the list becomes empty. The default value does not apply because the filter sends a postback parameter but with an empty value. So I added a new hidden field to send the filter value to my XLVWP and fill this field with javascript while the user enters the text into the filter:


<input type="hidden" name="searchText" id="searchText" />
Search: <input onkeyup="document.getElementById('searchText').value = this.value == '' ? '###' : this.value; javascript: __doPostBack('ctl00$m$g_09891d16_ead7_4eb6_9588_3c2eb636c6ea$ctl02','cancel');" />

Now it works perfectly. There is no need for the manual refresh button now. To remove it form XLVWP you can just uncheck ‘Show Manual Refresh Button’ in its properties.

How to Embed a Workbook in SharePoint Using Excel Web Access


You may also be interested in: SharePoint Conference.ORG 2013


 

Editor’s note: Contributor Alexandru Dionisie is an Internet Professional and Technical Writer. Follow him @AlexDionisie

According to Microsoft:

- Excel Services is a Microsoft Office SharePoint technology that makes it simple to use, share, secure, and manage Microsoft Office Excel 2007 workbooks (.xslx, xslb) as interactive reports in a consistent way throughout the enterprise.

To be more specific; you can use this service to interact with various workbooks hosted in SharePoint.

Unlike SkyDrive, where we can get an embed code, here everything is simpler.

Of course, we can use embed code, but for this example we will use a web part.

How it’s done

  • upload a workbook into a site library
  • access the desired page
  • go into Edit Mode
  • from Insert click on More Web Parts
  • from the Business Data category insert the Excel Web Access Web Part

2013-04-03-EmbedWorkbook-01.png

  • now we have to access the Tool Pane.

2013-04-03-EmbedWorkbook-02.png

  • in this panel, depending on the requirements, we will alter the desired properties
  • for this example we will specify a workbook, a Name Range and change the width and height.

2013-04-03-EmbedWorkbook-03.png

2013-04-03-EmbedWorkbook-04.png

After we complete all these changes, we save and then exit the Edit Mode so we can view the result.

2013-04-03-EmbedWorkbook-05.png

How to Embed a PowerPoint Presentation in SharePoint Online 2010


You may also be interested in: SharePoint evolution conference 2013


 

Editor’s note: Contributor Alexandru Dionisie is an Internet Professional and Technical Writer. Follow him @AlexDionisie

Embeding a presentation into a SharePoint site can be a bit complicated, because there is no command to generate an embed code, like the one from SkyDrive.

If the presentation is hosted on SkyDrive, you can just copy the embed code from there. If it’s not, I will show you how to extract a custom link and then alter it so we can get an embed code.

How it’s done:

  • upload a presentation on SharePoint;
  • we need a browser that has Developer ToolsMozilla Firefox şi Internet Explorer 8, 9, 10;
  • open the presentation in PowerPoint Web App;
  • now we have to search the iframe code and copy it.

2013-02-14-EmbedPowerPoint-01.png

From the copied code extract what’s after src=” until (and including) aspx.

Original Code:


<iframe width=”100%” height=”100%” frameborder=”0″ style=”position: absolute; top: 0px; left: 0px; right: 0px; bottom: 0px;” src=”PowerPointFrame.aspx?PowerPointView=ReadingView&d=Fd95641e8aac148368f6d1e3996de1201m11011d1d984b439aa63d8119661f1028m8d93dc0bef1941839992f37b0dbc2c22m&source=https://office365ro.sharepoint.com/SitePages/Home.aspx” id=”powerPointFrame”></iframe>

Extracted Code:


PowerPointFrame.aspx?PowerPointView=ReadingView&d=Fd95641e8aac148368f6d1e3996de1201m11011d1d984b439aa63d8119661f1028m8d93dc0bef1941839992f37b0dbc2c22m&source=https://office365ro.sharepoint.com/SitePages/Home.aspx

Now, to the final code we must add:


/_layouts/PowerPointFrame.aspx?PowerPointView=ReadingView&d=Fd95641e8aac148368f6d1e3996de1201m11011d1d984b439aa63d8119661f1028m8d93dc0bef1941839992f37b0dbc2c22m&source=https://office365ro.sharepoint.com/SitePages/Home.aspx

After doing these steps, we return to the desired page and enter into Edit Mode.

Then, we insert a Page Viewer web part and in the Link box paste the final code.

2013-02-14-EmbedPowerPoint-02.png

After some minor tweaks we save all changes.

The final result is this:

2013-02-14-EmbedPowerPoint-03.png

SharePoint Control Overrides My JavaScript “Keypress” Event


You may also be interested in: SharePoint Services with mindfiresolutions


 

Editor’s note: Contributor Alex Choroshin is a Sharepoint Team Leader at Bank Leumi. Follow him @choroshin

When you want to bind an event handler to the "keypress" JavaScript event, or trigger that event on an element, you can achieve this using a JQuery handler like .keypress( handler(eventObject) ).

For example, binding "keypress" event to a text box on your custom control:


$("#input").keypress(function (event) {
var code = (event.keyCode ? event.keyCode : event.which);
 if(code == 13) //Enter keycode
 // your logic here...
}
});

As you can see, the task is very simple and straightforward, but when dealing with SharePoint, sometimes things get pretty messy.

Scenario: You developed a custom control with a text box and used a "keypress" JavaScript event to trigger the “Enter” key press event . You added the control to a SharePoint page and it worked, but after adding a SharePoint OOTB control that also has a text box, your "keypress" event automatically stops working. Why you ask? Well, it’s all about priorities. If your JS code is last in order, then your code would probably work, but you can never be sure.

Solution: Use the event.preventDefault() method to stop the default action of the event, in our case, SharePoint OOTB controls.


$("#input").keypress(function (event) {
var code = (event.keyCode ? event.keyCode : event.which);
 if(code == 13) //Enter keycode
//stop the default action of the Enter key 
 event.preventDefault();
 // your logic here...
}
});

This way, we gained control over our events and managed to keep the OOTB functionality working.

Hope you find this article handy .

SharePoint: How to Show 2 or More Web Parts Side-by-Side


You may also be interested in: SharePoint Smart Notifications by KWizCom


 

Editor’s note: Contributor Alexandru Dionisie is an Internet Professional and Technical Writer. Follow him @tutorialeoffice

By default there is no option that can allow us to display 2 or more web parts side-by-side.

To fix this we can use a table.

How do we do it?

  • enter in Edit Mode;

  • choose a location for the table;

  • insert a table with n columns and n rows (depends on the number of web parts);

If you already have some web parts in the page just drag & drop them in the table.

If not, click in a column and then insert the desired web part.

2012-10-16-2WebParts-01.png

After doing all the steps Save & Close to see the result.

2012-10-16-2WebParts-02.png

Chat in SharePoint – The Easy Way (No Code)


You may also be interested in: UserVersity lessons from Mindsharp


 

Editor’s note: Contributor Chris Stone is a SharePoint Consultant and Trainer for Sector Learning Solutions. Follow him @sharepointee

I Had a client ask if she could setup a chat on the main page of her SharePoint. My first thought went to something more complex, coded in JS, integrated with a server.. and then I realized it was too much. So I threw that out and went with something simple instead.

A custom SharePoint list with a single column and a webpart view on the main page with AJAX refresh. Looks like this.

2012-07-11-ChatInSP-01.png

How did I build it?

Step 1. Site Actions > More Options > Custom List (Named “Chat”), Click Create.

Step 2. From the Chat List, click the List tab, List Settings, in the columns section, click “Title” and rename it “Message”, click OK, Then click Advanced Settings and in the Item-level Permissions area switch the Create and Edit access to “Create items and edit items that were created by the user” scroll down and click OK.

Step 3. Go back to the All Items view of the list, on the Browse Tab use the drop down on All Items to “Modify this View”, untick the “Attachments” display box, tick the “Created” and “Created By” boxes. I switched the order of those two because I think it looks better, but you do not have to.

Scroll down to the “Sort” section, sort by column “Created” in ascending order.

Scroll down to the “Item Limit” section, I reduced this to 20 so that it doesn’t take up too much of my main page.

Scroll to the bottom (or top) and click OK.

Step 4. Go back to the main page (or any page you want to show this chat on) and go into edit mode. Insert a webpart and select the new Chat list you created and click add.

Step 5. Use the drop down menu from the downward triangle that appears in the top right of the webpart when you hover your mouse over it. Select “Edit Web Part” you will get an options bar on the right hand side of the screen. In the selected view, choose “All Items” a pop up will apear, click ok, go down to the “AJAX Options” section and tick the “Show Manual Refresh Button” and “Enable Asynchronous Automatic Refresh” options, change the number in the box below to 15 (As fast as it will allow you to go). Click OK at the bottom. Save and Close the Page (top right, diskette icon).

Step 6. Chat away by clicking “Add new item”.

Questions? Comments? Leave them in the Comments section below.

I will do a post on how to setup “Private” messages in this chat at a later date.