Friday, October 22, 2010

The result is out

Hi All,

Finally the result is out.

Looks like people want Microsoft to bring something like Google TV to the market.

Friday, October 8, 2010

Showing twitter followers and friends in SharePoint

Hi All,

Social networking has already a hit in the internet now and almost every site has one or the other social networking integration. At least they show the followers and friends for sure.

So why SharePoint stay behind? SharePoint has one very powerful web part, which is content editor web part. Twitter provides a fantastic way to display the list of followers and friend. All you need is internet connection and you are good to go.

Open any page where in you want to show the twitter followers and friends. Add content editor web part. And add the following code.

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<script type="text/javascript" src="http://twitter-friends-widget.googlecode.com/files/jquery.twitter-friends-1.0.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$('#friends').twitterFriends({
debug:1
,username:'sharepointkings'
});
});
</script>

<div id="friends"></div>


<div class="twitter-friends" options="{
friends:1
,username:'sharepointkings'
}"></div>


Replace SharepointKings username to your own name.

And here is the result that you get. Here it is a snap only; however you’ll get animated follower list and friends. Try it in your SharePoint site and you will get the animated list.

Wednesday, October 6, 2010

Getting SharePoint Rich text field data using JavaScript

Hi All,

We all know that we can get a value of single line text field, drop downs, choice field value using jQuery very easily using jQuery.

However the same is not true in case of using multiline rich text field. When you try to apply same methods of jQuery, it fails to returns you the value.

Well, to get the same stuff done with multiline rich text field, we need to use the same technique but in some different way.

To demonstrate, add one column in your list which is multiline rich text field. And now on NewForm of that list, add one content editor web part. (I prefer take up the SharePoint discussion list which has default rich text field)

I have done the same using JavaScript even have not used jQuery file. I have added content editor web part and placed the following code in it. To demonstrate, I have replaced the onclick handlers of the page to our own handler which pops up the content of rich text field as alert.


<script type="text/javascript" language="javascript">
var objForm = document.forms[0];
var count;

window.onload = StartUpCustomScript;
function StartUpCustomScript() {
ChangeOkButtonOnclickEvent("Input", "SaveItem");
}

function ChangeOkButtonOnclickEvent(tagName, identifier) {
var len = identifier.length;
var tags = document.getElementsByTagName(tagName); /*find all Input type controls on page (ie. control with tag <Input/>)*/
for (var i = 0; i < tags.length; i++) {

var tempString = tags[i].name;

if (tempString.indexOf(identifier) == tempString.length - len) /*find any Input type controls on page has its name ending with 'SaveItem'*/
{
//alert(tempString);
if (tags[i].attributes["onclick"] != null) {
/*if found, replace it default onclick with our custom script*/

var func = tags[i].attributes["onclick"].value.replace("if (!PreSaveItem())", " return function1('" + tags[i].name + "');if (!PreSaveItem())");
/*remove its default onclick event*/
tags[i].onclick = null;
/*re-register its onlick event with new script*/
tags[i].attachEvent("onclick", new Function(func));
}
}
}
//return null;
}

function function1(z)
{
var textName = "ctl00_m_g_1a3ed0d9_ea62_4a4e_adc0_30d1184b5ad0_ctl00_ctl04_ctl01_ctl00_ctl00_ctl04_ctl00_ctl00_TextField";
var bodyText, spamWordText, clientWordText;
var rtClientCount=0;
var arrBodyText = new Array();
var arrSpamWordText = new Array();
count=0;
spamWordText="";
clientWordText="";

var docEditor = RTE_GetEditorDocument(textName);
var textRange=docEditor.body.createTextRange();
bodyText=textRange.htmlText;
alert(bodyText);
return true;
}
</script>


I n function1(z) we have taken rich text field control client ID, you can get the same by looking into the page view source.

var textName = "{rich field client ID}"

and when you add the above code to the content editor web part and then create New Item and click on Ok, and see what you get.



Clicking on OK button is replaced by our own code just to demonstrate how to fetch the value of rich text field in SharePoint. In real scenarios, this can be done in different ways.

Hope that this idea of how to fetch value of multiline rich text field will help many.

Finally the result is out

Hi All,

We asked about new Internet Explorer 9 and this is what we got. Looks like IE9 is heating up the market.




Share your SharePoint Experiences with us...
As good as the SharePointKings is, we want to make it even better. One of our most valuable sources of input for our Blog Posts comes from ever enthusiastic Visitors/Readers. We welcome every Visitor/Reader to contribute their experiences with SharePoint. It may be in the form of a code stub, snippet, any tips and trick or any crazy thing you have tried with SharePoint.
Send your Articles to sharepointkings@gmail.com with your Profile Summary. We will Post them. The idea is to act as a bridge between you Readers!!!

If anyone would like to have their advertisement posted on this blog, please send us the requirement details to sharepointkings@gmail.com