A Practical Guide to SharePoint 2013

A Practical Guide to SharePoint 2013
A Practical Guide to SharePoint 2013 - Book by Saifullah Shafiq

Wednesday, February 29, 2012

Interesting SharePoint Articles

1. Balancing Collaboration and Information Security in your SharePoint Environment (Via Emily)

URL: http://arnoldit.com/wordpress/2012/02/28/balancing-collaboration-and-information-security-in-your-sharepoint-environment/

2. Achieving Accessibility in SharePoint 2010 (Via Ray Fleming)

URL: http://blogs.msdn.com/b/education/archive/2012/02/28/achieving-accessibility-in-sharepoint-2010.aspx

3. Challenges in SharePoint Migration

URL: http://www.dshift.com/sharepoint/challenges-in-sharepoint-migration/?utm_source=rss&utm_medium=rss&utm_campaign=challenges-in-sharepoint-migration

4. Designing Lists during SharePoint (Via Alan)

URL: http://www.rremote.com/designing-lists-during-sharepoint/

5. First Impressions: SharePoint On line’s Site Templates (Via Nicole)

URL: http://brainlava.com/first-impressions-sharepoint-online-site-template/

6. SSRS infrastructure in SharePoint 2010 integrated mode (Via Nikander & Margriet Bruggeman)

URL: http://sharepointdragons.com/2012/02/28/ssrs-infrastructure-in-sharepoint-2010-integrated-mode/

7. SharePoint Resolve Principal for ADFS users (Via Kjell-Sverre Jerijærvi)

URL: http://kjellsj.blogspot.com/2012/02/sharepoint-resolveprincipal-for-adfs.html

8. How to restrict visibility of SharePoint 2010 lists and libraries

URL: http://www.sharepointblog.co.uk/2012/02/how-to-restrict-visibility-of.html

9. SharePoint 2010 Brags of New Enterprise Intelligence attributes (Via Jack Davison)

URL: http://virtualblackswanmarketing.net/?p=2156&utm_source=rss&utm_medium=rss&utm_campaign=sharepoint-2010-brags-of-new-business-intelligence-features

10. Integrating SharePoint and Outlook 2007

URL: http://andsmedia.blogspot.com/2012/02/integrating-sharepoint-and-outlook-2007.html

Tuesday, February 28, 2012

Interesting SharePoint Articles

1. SharePoint Online Development experiences (Via Rick Snyder)

URL: http://ricksnyderitconsulting.blogspot.com/2012/02/sharepoint-online-development.html

2. HANDY TABLE FOR COMPARISON OF SHAREPOINT 2010 SERVER AND SHAREPOINT ONLINE FEATURES (Via Allice)

URL: http://sharepointsemantics.com/2012/02/handy-table-for-comparison-of-sharepoint-2010-server-and-sharepoint-online-features/

3. SharePoint 2010 Avoiding Broken Links with Document ID Tool

URL: http://sharepoint2010blog.wordpress.com/2012/02/26/sharepoint-2010-avoiding-broken-links-with-document-id-tool/

4. SharePoint Machine 2010 Web hosting – ASPHostPortal Safe Store Services Guidelines in SharePoint

URL: http://msmasaze.com/sharepoint-machine-2010-web-hosting-asphostportal-safe-store-services-guidelines-in-sharepoint/

5. Visio Services in SharePoint Server 2010 in response to user mouse click event

URL: http://www.hotsoftwareblog.com/visio-services-in-sharepoint-server-2010-in-response-to-user-mouse-click-event.html

6. Kill the SharePoint Bugs Before They Can Gestate (Via Stephen E. Arnold)

URL: http://arnoldit.com/wordpress/2012/02/27/kill-the-sharepoint-bugs-before-they-can-gestate/

7. Dependable SharePoint Form Technology Solutions

URL: http://www.asps.in/computer-internet/dependable-sharepoint-form-technology-solutions/

8. SharePoint Contacting – Emphasizing Benefit Of SharePoint On-line

URL: http://lecampusministry.org/sharepoint-contacting-emphasizing-benefit-of-sharepoint-on-line/

9. SharePoint Referring with – Emphasizing the value Of SharePoint Internet

URL: http://joomla-bd.org/sharepoint-referring-with-emphasizing-the-value-of-sharepoint-internet

10. Agile Scrum for SharePoint Projects (Via JOELSEF )

URL: http://joelsef.blogspot.com/2012/02/agile-scrum-for-sharepoint-projects.html

11. SharePoint Turning to – Emphasizing The value Of SharePoint On the internet

URL: http://www.spanish-translations.com/?p=1362

Monday, February 27, 2012

Interesting SharePoint Articles

1. SharePoint, Training Not Required? (Via Emily)

URL: http://arnoldit.com/wordpress/2012/02/24/sharepoint-training-not-required/

2. Video: Developing your first SharePoint Online solution (Via Ty Anderson)

URL: http://www.add-in-express.com/creating-addins-blog/2012/02/23/developing-sharepoint-online-solution-video/

3. SharePoint 2010 MP: how to automate the SharePoint. Config configuration

URL: http://www.vnext.be/2012/02/23/sharepoint-2010-mp-how-to-automate-the-sharepointmp-config-configuration/

4. Deactivate SharePoint Foundation Web Application Service on Central Admin or Deploy Custom Solutions from Central Admin (Via nikspatel)

URL: http://nikspatel.wordpress.com/2012/02/24/deactivate-sharepoint-foundation-web-application-service-on-central-admin-or-deploy-custom-solutions-from-central-admin/

5. Find out More about Windows 7 and SharePoint via Learn ITs Windows 7 and SharePoint Courses

URL: http://plonktechnology.com/?p=3563

6. LOOKUP FIELD ISSUES IN SHAREPOINT 2010

URL: http://gourangaland.wordpress.com/2012/02/24/lookup-field-issues-in-sharepoint-2010/

7. Lync and Learn - Why SharePoint Online? (Via JoshT_MSFT)

URL: http://community.office365.com/en-us/b/office_365_technical_blog/archive/2012/02/23/lync-and-learn-why-sharepoint-online.aspx

8. Business enterprise Intelligence not to mention SharePoint 2010

URL: http://mashupartist.com/business-enterprise-intelligence-not-to-mention-sharepoint-2010/

Friday, February 24, 2012

Interesting SharePoint Articles

1. Upcoming features in SharePoint Online (Via Roshan N Y )

URL: http://blogs.msdn.com/b/sharepoint__cloud/archive/2012/02/22/upcoming-features-in-sharepoint-online.aspx

2. Bearing with the Hassles of SharePoint (Via Emily)

URL: http://arnoldit.com/wordpress/2012/02/23/bearing-with-the-hassles-of-sharepoint/

3. SharePoint

URL: http://www.pandamessenger.org/?p=1608

4. Thesaurus in SharePoint 2010 Search (SharePoint Shop Talk Question)

URL: http://spforsquirrels.blogspot.com/2012/02/thesaurus-in-sharepoint-2010-search.html

5. Using JavaScript in SharePoint Content (Via Sanna Pehkonen)

URL: http://borderingdotnet.blogspot.com/2012/02/using-javascript-in-sharepoint-content.html

6. UDOCX and SharePoint On-Premise

URL: http://blog.udocx.com/2012/02/23/udocx-and-sharepoint-on-premise/

7. SharePoint 15 (Via NITINKUMAR KAKULDE)

URL: http://nytyn.blogspot.com/2012/02/sharepoint-15.html

8. Publishing Service Manager Announcements to SharePoint Using Orchestrator (Via Travis Wright MSFT)

URL: http://blogs.technet.com/b/orchestrator/archive/2012/02/22/publishing-service-manager-announcements-to-sharepoint-using-orchestrator.aspx

9. SharePoint 2010 for Collaboration: Something Old, Something New, Something Blue (Via MICHAEL SAMPSON)

URL: http://www.messagingnews.com/story/sharepoint-2010-collaboration-something-old-something-new-something-blue

10. The Good Part of SharePoint Consulting On the way to Achieving your Objectives

URL: http://hmjproject.com/the-good-part-of-sharepoint-consulting-on-the-way-to-achieving-your-objectives/

11. Creating SharePoint 2010 Content Organizer Rules programmatically

URL: http://www.thorntontechnical.com/tech/sharepoint/creating-sharepoint-2010-content-organizer-rules-programmatically

Thursday, February 23, 2012

Interesting SharePoint Articles

1. Why SharePoint is so popular yet gets Such a Bad Rap

URL: http://www.jmorganmarketing.com/microsoft-sharepoint-popular-bad-rap/

2. Document Preview and Thumbnail issue post SharePoint 2010 December CU 2011installation (Via Ali)

URL: http://blogs.msdn.com/b/alimaz/archive/2012/02/21/document-preview-and-thumbnail-issue-post-sharepoint-2010-december-cu-2011.aspx

3. SharePoint 2010 – Introduction (Via Jean Paul)

URL: http://jeanpaulva.com/2012/02/22/sharepoint-2010-introduction/

4. Spend a Saturday in the Big Easy Discussing SharePoint (Via Stephen E. Arnold)

URL: http://arnoldit.com/wordpress/2012/02/22/spend-a-saturday-in-the-big-easy-discussing-sharepoint/

5. Deployment Manager for SharePoint 2.1 Simplifies, Accelerates & Controls #SharePoint Solutions Deployment (Via Alex Kirillov)

URL: http://communities.quest.com/community/sharepointforall/experts-blogs/blog/2012/02/22/deployment-manager-for-sharepoint-21-simplifies-accelerates-controls-qsharepoint-solutions-deployment

6. SharePoint Vs (Via Ben)

URL: http://www.medialightbox.com/blog/2012/02/sharepoint-vs/

7. Have the right SharePoint 2010 governance

URL: http://intranet-pioneer.com/2012/02/22/have-the-right-sharepoint-2010-governance/

8. with the Development of Excellent SharePoint Interface Probabilities of Case…

(Via PatrickRoberts)

URL: http://sarticles.in/with-the-development-of-excellent-sharepoint-interface-probabilities-of-case-failures-get-decreased/

9. Tips for SharePoint Beginners

URL: http://blog.mikehacker.net/2012/02/21/tips-for-sharepoint-beginners/

10. Migrating from MOSS 2007 to SharePoint 2010

URL: http://www.sharepointboost.com/blog/migratingfrom-moss-2007-to-sharepoint-2010/

Wednesday, February 22, 2012

Interesting SharePoint Articles

1. The missing link in all SharePoint Projects (Via Andrew Woodward)

URL: http://www.21apps.com/sharepoint/the-missing-link-in-all-sharepoint-projects/

2. Documenting a SharePoint Farm (Via Giles Hamson)

URL: http://ghamson.wordpress.com/2012/02/20/documenting-a-sharepoint-farm/

3. The Azure Custom Claim Provider for SharePoint Project Part 3

(Via Steve Peschka)

URL: http://blogs.technet.com/b/speschka/archive/2012/02/20/the-azure-custom-claim-provider-for-sharepoint-project-part-3.aspx

4. Using SharePoint Effectively: Simple Tips for your Users

(Via Emilly)

URL: http://arnoldit.com/wordpress/2012/02/21/using-sharepoint-effectively-simple-tips-for-your-users/

5. Deciding on the Most Effective Tutorial for SharePoint Designer 2010 (Via Mikeb)

URL: http://www.talking-sharepoint.com/sharepoint_1/SharePoint/deciding-on-the-most-effective-tutorial-for-sharepoint-designer-2010/?utm_source=rss&utm_medium=rss&utm_campaign=deciding-on-the-most-effective-tutorial-for-sharepoint-designer-2010

6. Looking for sharepoint training (Via Diven02)

URL: http://www.101apartements.com/?p=61

7. SharePoint Support for Business Need

URL: http://www.frelia.com/2012/02/sharepoint-support-for-business-need.html

8. Managed accounts in SharePoint 2010

URL: http://foxitblogs.wordpress.com/2012/02/21/managed-accounts-in-sharepoint-2010/

Tuesday, February 21, 2012

Interesting SharePoint Articles

1. FAST Search for SharePoint Needs to Be Babied (Via Stephen E. Arnold)

URL: http://arnoldit.com/wordpress/2012/02/20/fast-search-for-sharepoint-needs-to-be-babied/

2. Instructor Lead SharePoint User Training and Video Tutorials Produce Knowledgeable Users

URL: http://www.talking-sharepoint.com/sharepoint_1/SharePoint/instructor-lead-sharepoint-user-training-and-video-tutorials-produce-knowledgeable-users/?utm_source=rss&utm_medium=rss&utm_campaign=instructor-lead-sharepoint-user-training-and-video-tutorials-produce-knowledgeable-users

3. Rackspace to add SharePoint services with strategic acquisition (Via Jolie O'Dell)

URL: http://venturebeat.com/2012/02/16/racksapce-sharepoint/

4. Concept Searching Gold Sponsor at the SharePoint Technology Conference in San Francisco

URL: http://bluemeanieme.com/2012/02/20/concept-searching-gold-sponsor-at-the-sharepoint-technology-conference-in-san-francisco/

5. SharePoint: connection consumers and customizations (Via Kate)

URL: http://blog.softartisans.com/2012/02/20/sharepoint-connection-consumers-and-customizations/

6. Rack space buys SharePoint911 for (what else?) SharePoint cred (Via Barb Darrow )

URL: http://gigaom.com/cloud/rackspace-buys-sharepoint911-for-what-else-sharepoint-cred/

7. Determine SP2010 edition & patching Level

URL: http://blog.sharepointsite.co.uk/2012/02/determine-sp2010-edition-patching-level.html

Monday, February 20, 2012

Interesting SharePoint Articles

1. Learn How to Fix the Most Common SharePoint Mistakes (Via Stephen E. Arnold)

URL: http://arnoldit.com/wordpress/2012/02/10/learn-how-to-fix-the-most-common-sharepoint-mistakes/

2. SharePoint 2010 – The annoying Database GUID Name (Via docteurl)

URL: http://www.docteurl.com/sharepoint-2010-the-annoying-database-guid-name/?utm_source=rss&utm_medium=rss&utm_campaign=sharepoint-2010-the-annoying-database-guid-name

3. How to Change the URL of the SharePoint 2010 Central Administration

URL: http://extremeengineers.net/?p=111

4. Limiting the Number of Tasks in a SharePoint Task List (Via John Milan)

URL: http://intelligantt.blogspot.com/2012/02/limiting-number-of-tasks-in-sharepoint.html

5. Adding a new managed account in SharePoint 2010 using Power Shell (Via RameshRK)

URL: http://blogs.msdn.com/b/rkramesh/archive/2012/02/09/adding-a-new-managed-account-in-sharepoint-2010-using-powershell.aspx

6. SharePoint and Identity Management–Part 3 of 3

by Richard Taylor

URL: http://blogs.perficient.com/portals/2012/02/10/sharepoint-and-identity-managementpart-3-of-3/

7. Link an item to its URL with itemstyle.xsl in SharePoint 2010 (Via bentedder)

URL: http://www.bentedder.com/link-an-item-to-its-url-with-itemstyle-xsl-in-sharepoint-2010/

Twitter, Geolocation and SharePoint 2010





I wrote about Geolocation and SharePoint in my last article which you can read at the following URL:

HTML5 Geolocation and SharePoint 2010

In this article, we will extend the idea further and include Twitter. In last article we saw how one can find location of site visitors using HTML5 Geolocation feature. Now we will use that feature to find Twitter users in your area. We will add two text boxes in the application. One to enter the search term and the other to enter the radius of the search. Application will first find your location on the map and then search in the proximity of your location. You can set radius to any value you like. Application will find Twitter users in that radius of your location and then show their logo, name, tweet and tweet time. It works in browsers as well as mobile devices. If you haven't figured out how to run HTML5 in SharePoint, read following article.

HTML5 Video and SharePoint 2010

Jump to section "Using HTML5 in SharePoint 2010". You will find all the details in that section.

Create a new ASPX page in your application. Make sure masterpagefile points to your new master page. You will find this attribute in the first line of the page.

<%@ Page Language="C#" masterpagefile="../_catalogs/masterpage/v5.master" title="Demo"

inherits="Microsoft.SharePoint.WebPartPages.WebPartPage, Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral,
PublicKeyToken=71e9bce111e9429c" meta:progid="SharePoint.WebPartPage.Document" meta:webpartpageexpansion="full" %>

See red colored text above. I named my new master page "v5.master".


Your second line in the ASPX page will be:


<asp:Content ContentPlaceHolderId="PlaceHolderAdditionalPageHead" runat="server">

And then starts the real code. See below.

function
twitterSearch(){

var gps =
navigator.geolocation;
if
(gps){

gps.getCurrentPosition(searchTweets,showError);
}
else
{
searchTweets();
}
}

This function gets the current position of the user. searchTweets() is the function that is called if current location is found successfully. searchTweets() is next, shown below.



function
searchTweets(position){

var query =
"
http://search.twitter.com/search.json?callback=searchResults&q=";
query +=
document.getElementById("searchBox").value;
if
(position){
var lat =
position.coords.latitude;
var lng =
position.coords.longitude;
query +=
"&geocode=" + escape(lat + "," + lng + "," +
document.getElementById("radiusBox").value +
"mi");
}

var script =
document.createElement("script");
script.src =
query;
document.getElementsByTagName("head")[0].appendChild(script);
}

searchResults() is the callback function. We pass search keyword in the query parameter called "q" and then we pass geocode that comprises of latitude, longitude and radius. Then we add this search query dynamically to the page body. searchResults() function is given below:



function
searchResults(response){
var tweets =
response.results;
tweets.forEach(function(tweet){
tweet.linkUrl
= "
http://twitter.com/#!/"
+ tweet.from_user + "/status/" +
tweet.id;
});
createTable(tweets);
}

In searchResults() we read each tweet and create results table. We pass all
tweets to the createTable() function. createTable() function is given below:


function
createTable(tweets){
var counter =
1;
var rows =
tweets.map(function(tweet){
counter++;
return
createTableBody(tweet.from_user, tweet.profile_image_url,
tweet.text,
tweet.linkUrl,
tweet.created_at, tweet.geo, counter % 2 ==
0);
});

document.getElementById("searchResults").innerHTML
=
createTableSkeleton();
rows.forEach(function(row){
document.getElementById("resultsTable").appendChild(row);
});
}


createTableSkeleton() function creates

the table skeleton and header
row.



function
createTableSkeleton()
{
var tbl = "<table
id='resultsTable' border='1'
bgcolor='lightskyblue'>";
tbl +=
"<TR><TH><h3>Logo</h3></TH>";
tbl
+=
"<TH><h3>User</h3></TH>";
tbl
+=
"<TH><h3>Tweet</h3></TH>";
tbl
+= "<TH><h3>Tweeted
At</h3></TH></TR><BR><BR>";
tbl
+= "</table>";

return
tbl;
}


createTableBody() creates the main body that shows the results.



function createTableBody(userID, logoUrl,
tweetText, linkUrl, created_At, geo,
IsAlternateRow)
{


var resultsRow =
document.createElement("tr");
if
(IsAlternateRow){

resultsRow.setAttribute("class", "odd");

}
else

{
resultsRow.setAttribute("class",
"even");
}

var srcCell =
document.createElement("td");

srcCell.setAttribute("class","src");

resultsRow.appendChild(srcCell);


var logo =
document.createElement("img");
logo.src
= logoUrl;
logo.setAttribute("alt",
userID);
logo.setAttribute("height",
48);
logo.setAttribute("width",
48);

srcCell.appendChild(logo);


var user =
document.createElement("td");

user.setAttribute("class","src");

resultsRow.appendChild(user);

user.appendChild(document.createTextNode(userID));



var messageCell =
document.createElement("td");

messageCell.setAttribute("class","msg");
var link =
document.createElement("a");

link.setAttribute("href", linkUrl);

link.setAttribute("target", "_blank");

link.appendChild(document.createTextNode(tweetText));

messageCell.appendChild(link);

resultsRow.appendChild(messageCell);



var created_at =
document.createElement("td");

created_at.setAttribute("class","src");

resultsRow.appendChild(created_at);

created_at.appendChild(document.createTextNode(created_At));



return
resultsRow;
}


Then we have the style sheet.


<style type="text/css">
td
{
padding-top:
15px;
padding-right:
15px;
padding-bottom:
20px;
padding-left:
15px;
border: 1px solid
black;
}
table {
text-align:
center;
border-collapse:
collapse;
}
a:link {

text-decoration: none;
color:
#0000ff;
}
.msg {
text-align:
left;
padding-left:
8px;
}
tr.odd {
background-color:
#effbff;
}
tr.even
{
background-color:
#fff8b2;
}
.src {

text-align: center;
font-style:
normal;
padding:
10px;
}
</style>

Finally we have the html controls. Results are shown in "searchResults" DIV.


<asp:Content
ContentPlaceHolderId="PlaceHolderMain"
runat="server">
<div
id="main">
<label for="searchBox">Enter
Search
Term:</label>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input
type="text" id="searchBox"/><br>
<label
for="radiusBox">Enter Radius (in
miles):</label>
<input type="text"
id="radiusBox"/>
<input type="button"
value="Search Twitter"
onclick="twitterSearch()"/>
</div>
<div
id="searchResults">
</div>


</asp:Content>

Click here to download complete code (ASPX file in zip format)

Now access this ASPX page in browser and you are done. Again if you want to see how to configure SharePoint to run HTML5 code, please visit following URL. It has complete detail on how to configure the server.

HTML5 Video and SharePoint 2010

If you want to test this code in your browser, use following link:

http://walisystemsinc.com/sharepoint/art/twittersearch/twitterSearch.htm

Enter search term and the radius and click Submit. Your browser will ask for your permission to use your location. Allow it
and search will show all Twitter users in your area tweeting about the search keyword.

This is how it will look in SharePoint:



Figure 1 : Twitter results in SharePoint

If you access following URL in your browser, you will see results as shown below in Figure 2.

http://walisystemsinc.com/sharepoint/art/twittersearch/twitterSearch.htm


Figure 2: Twitter results in Internet Explorer browser


In mobile, if you access the same URL, the results will look as following:

Figure 3: Permission to access your location



Figure 4: Twitter search results on iPhone



Hope you enjoyed this article.

Click here to download complete code (ASPX file in zip format)




HTML5 Geolocation and SharePoint 2010

Let's see how we can take advantage of HTML5

Geolocation feature in SharePoint. Geolocation allows you to find the location of your site visitors. There can be many uses of this feature. For example, you can use it to gather statistics for your site. You can then create a graph or chart widget and show countries that visited your site or blog the most. There are endless possibilities. You can also show cities. It can really come in handy if you run a business on the net. This thing also works in mobile devices. Looking at the number of mobile applications that are sprouting everyday, this feature can really play a pivotal role in gathering geographic data of your visitors. It will directly impact your sales and marketing campaigns. Plus point is that this feature has good support in every browser. Well if you are thinking about IE 7 and IE 8, forget it. You need IE 9 for this thing to work but that's for computers. For devices that use non-IE browsers, this isn't a problem. Almost all browsers support this feature. If you are afraid that this thing will not work in SharePoint, let me tell you that it will work. All you need is IE9 browser. If you don't have IE 9, start using Chrome or Firefox.


They work well with SharePoint 2010 and also support other standards that are popular today. This includes HTML5 technology.


If you want to learn how to prepare SharePoint for HTML5 usage, read following article:


HTML5 Video and SharePoint 2010


Jump to section "Using HTML5 in SharePoint 2010". You will find all the details in that section.

Once you are ready, start coding the HTML5 geolocation page.

Using Geolocation is very easy. Check out the following code:



navigator.geolocation.getCurrentPosition(
function(position)
{
alert("Your
location is: " + position.coords.latitude + ", " +
position.coords.longitude);
}<BR>);












We get latitude and longitude coords to find the

position of the user. OK, now we know how to find the location. Next goal is to show this location on the map. We will use Google Maps for this purpose. Again, it's not difficult to use Google Maps. If you haven't used Google Maps before, you may want to check out the documentation online at http://code.google.com/apis/maps/documentation/javascript. You have to include a Google Map link in your code before you can actually use this service. Add following line between the <head> ... </head> tags.




<head><br><title>HTML5Geolocation</title><br><scriptsrc="http://maps.google.com/maps/api/js?sensor=true"></script>
...<
BR>
</head>








Add a div tag to the page. This will be used to draw the map.



<body>
<div
id="mapCanvas"></div>







Use following style to design the map layout:



#mapCanvas
{
width: 650px;
height:
450px;
border: solid
1pxblue;
<BR>}











Now, you are ready to see everything in action. Call following function when the window loads:



window.onload = function() {
results =
document.getElementById("results");
var
myOptions = {
zoom: 13,

mapTypeId: google.maps.MapTypeId.ROADMAP
};










This code writes results in the "results" div. Variable myOptions contains options like zoom level and the map type. Map type that we are going to use is ROADMAP. After setting the options,
create the map:



map = new
google.maps.Map(document.getElementById("mapCanvas"),
myOptions);






Following code will set user's location on the
map:



function geolocationSuccess(position)
{


var location =
new
google.maps.LatLng(position.coords.latitude,position.coords.longitude);

map.setCenter(location);


var infowindow = new
google.maps.InfoWindow();



infowindow.setContent("This is your location on the
map!");

infowindow.setPosition(location);

infowindow.open(map);


results.innerHTML = "You are on the
map.";
}





























Variable location contains the exact location.

Then we show a box on the map with a message. We use InfoWindow() function to show the box. This box will appear at user's location. The following function will be called in case of failure:




function
geolocationFailure(positionError) {
if (positionError.code
== 1) {
results.innerHTML =

"You have decided not to share your
location.";
}
else if (positionError.code == 2)
{
results.innerHTML
=
"The network is down or the
positioning service can't be reached.";
}
else
if (positionError.code == 3) {

results.innerHTML =
"The attempt timed
out before it could get the location data.";
}

else {
results.innerHTML
=
"Unknown error. Please try
later.";
}


}


























In geolocationFailure() function we check different conditions to know the cause of failure and then show message accordingly. That's it.

Click here to download complete code (html file in zip
format)

Now you have the code. All you have to do is use it inside a SharePoint page. This has been demostrated in the following article so I am not going to repeat the steps again.

HTML5 Video and SharePoint 2010

Best way of running HTML5 code on a SharePoint page is to use a content editor web part and then access the URL of the HTML5 page inside the web part. You need to host the page in IIS first. After you have configured the content editor web part, open the SharePoint page in browser.

This is how the map will look like on your page:

Figure 1: Google Map with
Geolocation

And this is how it will look on your mobile:

Figure 2: Permission to allow device to use your current location

After you click OK, you see the map.

Figure 3: Google Map on your device using Geolocation

If you want to see your location in the browser, open following link in your browser:

http://walisystemsinc.com/sites/html5/GeolocationMap.html

Stay tuned! Next article will show you how to use Geolocation to find Twitter users in your area.

Sunday, February 19, 2012

HTML5 Geolocation and SharePoint 2010

HTML5 Geolocation and SharePoint 2010





 


HTML5 Geolocation and SharePoint 2010

Let's see how we can take advantage of HTML5 Geolocation feature in SharePoint. Geolocation allows you to find the
location of your site visitors. There can be many uses of this feature. For example, you can use it to gather statistics for your site. You can then create a graph or chart widget and show countries that visited your site or blog the most. There are endless possibilities. You can also show cities. It can really come in handy if you run a business on the
net. This thing also works in mobile devices. Looking at the number of mobile applications that are sprouting everyday, this feature can really play a pivotal role in gathering geographic data of your visitors. It will directly
impact your sales and marketing campaigns. Plus point is that this feature has good support in every browser. Well if you are thinking about IE 7 and IE 8, forget it. You need IE 9 for this thing to work but that's for computers. For devices that use non-IE browsers, this isn't a problem. Almost all browsers support this feature. If you are afraid that this
thing will not work in SharePoint, let me tell you that it will work. All you need is IE9 browser. If you don't have IE 9, start using Chrome or Firefox. They work well with SharePoint 2010 and also support other standards
that are popular today. This includes HTML5 technology.

If you want to learn how to prepare SharePoint for HTML5 usage, read following article:
Jump to section "Using HTML5 in SharePoint 2010". You will find all the details in that section.
Once you are ready, start coding the HTML5 geolocation page. Using Geolocation is very easy. Check out the following code:


navigator.geolocation.getCurrentPosition(
function(position)
{
alert("Your
location is: " + position.coords.latitude + ", " +
position.coords.longitude);
}<BR>);






We get latitude and longitude coords to find the position of the user. OK, now we know how to find the location. Next goal is to show this location on the map. We will use Google Maps for this purpose. Again, it's not difficult to use Google Maps. If  you haven't used Google Maps before, you may want to check out the documentation online at http://code.google.com/apis/maps/documentation/javascript.  You have to include a Google Map link in your code before you can actually use this service. Add following line between the <head> ... </head> tags.


<head><br><title>HTML5Geolocation</title><br><scriptsrc="http://maps.google.com/maps/api/js?sensor=true"></script>
...<
BR>
</head>



Add a div tag to the page. This will be used to draw the map.


<body>
<div
id="mapCanvas"></div>



Use following style to design the map layout:

#mapCanvas
{
width: 650px;
height: 450px;
border: solid 1pxblue;

}





Now, you are ready to see everything in action. Call following function when the window loads:



window.onload = function() {
  results =
document.getElementById("results");
  var
myOptions = {
    zoom: 13,
   
mapTypeId: google.maps.MapTypeId.ROADMAP
  };

 







This code writes results in the "results" div. Variable myOptions contains options like zoom level and the map type. Map type that we are going to use is ROADMAP. After setting the options, create the map:



map = new
google.maps.Map(document.getElementById("mapCanvas"),
myOptions);




Following code will set user's location on the map:


function geolocationSuccess(position)
{

      var location =
new
google.maps.LatLng(position.coords.latitude,position.coords.longitude);
     
map.setCenter(location);

var infowindow = new
google.maps.InfoWindow();

     
infowindow.setContent("This is your location on the
map!");
     
infowindow.setPosition(location);
     
infowindow.open(map);

 results.innerHTML = "You are on the
map.";
}











Variable location contains the exact location. Then we show a box on the map with a message. We use InfoWindow() function to show the box. This box will appear at user's location. The following function will be called in case of failure:




function
geolocationFailure(positionError) {
  if (positionError.code
== 1) {
    results.innerHTML =

     "You have decided not to share your
location.";
  }
  else if (positionError.code == 2)
{
    results.innerHTML
=
     "The network is down or the
positioning service can't be reached.";
  }
  else
if (positionError.code == 3) {
   
results.innerHTML =
     "The attempt timed
out before it could get the location data.";
  }
 
else {
    results.innerHTML
=
     "Unknown error. Please try
later.";
  }


}




















In geolocationFailure() function we check different conditions to know the cause of failure and then show message
accordingly. That's it.

Click here to download complete code (html file in zip format)

Now you have the code. All you have to do is use it inside a SharePoint page. This has been demostrated in the following article so I am not going to repeat the steps again.

HTML5 Video and SharePoint 2010

Best way of running HTML5 code on a SharePoint page is to use a content editor web part and then access the URL of the HTML5 page inside the web part. You need to host the page in IIS first. After you have configured the content editor web part, open the SharePoint page in browser.

This is how the map will look like on your page:


Figure 1: Google Map with Geolocation

And this is how it will look on your mobile:



Figure 2: Permission to allow device to use your current location

After you click OK, you see the map.



Figure 3: Google Map on your device using Geolocation

If you want to see your location in the browser, open following link in your browser:

http://walisystemsinc.com/sites/html5/GeolocationMap.html

Stay tuned! Next article will show you how to use Geolocation to find Twitter users in your area.

You can read this article with good formatting on our site. Here is the link:

http://www.walisystemsinc.com/sharepoint/art/geoloc/HTML5_Geolocation_and_SharePoint_2010.htm