Wow. SharePoint 2010 has lot of new features. Everyone knows that. But, among all of them, the main thing I have really loved is the HTML markup generated for the SharePoint 2010. You know what? They have replaced the tables with Div and ul, li etc. So, this is a very good thinking and change from SharePoint team which likes by all and browsers. Everyone knows what are the problems with TABLES and in SharePoint 2007 you find many many tables. But not any more in SharePoint 2010.
Below is the simple snapshot which is taken from the view source of SharePoint 2010 Publishing site template.
Saturday, February 27, 2010
Friday, February 26, 2010
SharePoint 2010 ECMAScript - How to know logged in user information
This is post which is simple and not really needed. But when I started writing the code in ECMAScript I have faced problems in getting the logged in user information. So, my readers may feel good after see this post and really most the users are looking for this too.
By this time, we have really understood all about ECMAScript Client Object Model and debugging. So, it's easy for us to know it well.
Please find the code below to get the current user information.
By this time, we have really understood all about ECMAScript Client Object Model and debugging. So, it's easy for us to know it well.
Please find the code below to get the current user information.
<script type="text/javascript"> ExecuteOrDelayUntilScriptLoaded(getWebUserData, "sp.js"); var context = null; var web = null; var currentUser = null; function getWebUserData() { context = new SP.ClientContext.get_current(); web = context.get_web(); currentUser = web.get_currentUser(); currentUser.retrieve(); context.load(web); context.executeQueryAsync(Function.createDelegate(this, this.onSuccessMethod), Function.createDelegate(this, this.onFailureMethod)); } function onSuccessMethod(sender, args) { var userObject = web.get_currentUser(); alert('User name:' + userObject.get_title() + '\n Login Name:' + userObject.get_loginName()); } function onFailureMethod(sender, args) { alert('request failed ' + args.get_message() + '\n' + args.get_stackTrace()); } </script>So, the above code returns you the user object and displays user name and user login name. You can customize it as you want and please let me know the feedback or questions you have.
SharePoint 2010 ECMAScript - how to know all methods in SP object and debug
After spent good time to write nice posts on Client Object Model and ECMAScript how to use, I want to present you another nice tip on how we know all the methods and properties available for the SP object in the ECMA javascript . MSDN documentation is not finalized or completed yet to know what properties and methods for SP objects have. And when you want to query something [like list or web] and you are not aware of what it has inside methods and properties, then the best way as far as I know is, using the Javascript debugging using Internet Explorer.
SharePoint 2010 - Client Object Model - ECMAScript - Introduction on how to use
In SharePoint 2010, the great feature is introducing the client object model [Read this article before proceed]. The great advantage with this is, we can do plenty of things without server side coding using the ECMAScript. There are plenty of default supported files to use and do whatever you want with the SP Package files. All javascript files will be found in the layouts folder. All of them starts with "SP" name.
ECMAScript works only for the current context. It means from outside of the site, you can't access the SharePoint data. This won't support the cross-site scripting.
How to add the reference to SP.js and access the data?
ECMAScript works only for the current context. It means from outside of the site, you can't access the SharePoint data. This won't support the cross-site scripting.
How to add the reference to SP.js and access the data?
Thursday, February 25, 2010
SharePoint 2010 - Complete details about Client Object Model
This is the introduction to the Client Object model introduced in the SharePoint 2010. This is going to be a huge help and useful part in SharePoint 2010 for developers and makes lot of customization to the existing SharePoint system.
In eariler versions, I mean till SharePoint 2007 the code runs using the SharePoint object model to run against the server which is running SharePoint. Other than the SharePoint server object model, other way is, simply reference the web service and use that to get and manipulate data. Then what is the need of SharePoint 2010 Client object model[Cleint OM] concept?
In eariler versions, I mean till SharePoint 2007 the code runs using the SharePoint object model to run against the server which is running SharePoint. Other than the SharePoint server object model, other way is, simply reference the web service and use that to get and manipulate data. Then what is the need of SharePoint 2010 Client object model[Cleint OM] concept?
Wednesday, February 24, 2010
Retrieving the COM class factory for component with CLSID {BDEADF26-C265-11D0-BCED-00A0C90AB50F} failed due to the following error: 800703fa
This is a SharePoint 2010 BETA edition exception. Most of the people who are working with SP2010 should get this exception. Below are the exception details:
Retrieving the COM class factory for component with CLSID {BDEADF26-C265-11D0-BCED-00A0C90AB50F} failed due to the following error: 800703fa.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Runtime.InteropServices.COMException: Retrieving the COM class factory for component with CLSID {BDEADF26-C265-11D0-BCED-00A0C90AB50F} failed due to the following error: 800703fa.
Workaround:
Special thanks to Bassem Georgi for the nice tip.
Retrieving the COM class factory for component with CLSID {BDEADF26-C265-11D0-BCED-00A0C90AB50F} failed due to the following error: 800703fa.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Runtime.InteropServices.COMException: Retrieving the COM class factory for component with CLSID {BDEADF26-C265-11D0-BCED-00A0C90AB50F} failed due to the following error: 800703fa.
Workaround:
- Doing an IISRESET solving the problem but it is solving temporarily.
- Open IIS and go to your SharePoint site. And find the application pool.
- Go to application pool, click Advanced settings, change the value for "Load User Profile" to "true".
Special thanks to Bassem Georgi for the nice tip.
Tuesday, February 23, 2010
JQuery 1.4.2 released
These guys are very quick and fast updates in releases. Jquery 1.4.2 is released and they came up with strong version. This version again improved plenty of things in terms of performance and some events. Fixed lot of issues and bugs. So, get it and use it. Read the complete list of features on their site.
http://blog.jquery.com/2010/02/19/jquery-142-released/
http://blog.jquery.com/2010/02/19/jquery-142-released/
Tuesday, February 16, 2010
SharePoint 2010 site templates not showing in create site page, How to get them?
This is a bit surprising to the people who are playing with SharePoint 2010 very first time. When we try to create subsites in the main site collection we need to pick the right site template and go. But, what if you are not able to see the list of site templates in the list?
User profile import problems in SharePoint 2010
I know, most of the SharePoint administrators and development team facing problems with importing or syncing up the active directory with user profile store or SSP in SharePoint 2010. There are many reasons and you need to read the complete documentation before do anything.
I have initiated the thread in MSDN forums here and still that is growing. User profile import
But, there are some configurations we need to check before do the user profile import. One of the important notes is "The farm is running either the Standard or Enterprise version of SharePoint Server 2010 and you have run the farm configuration wizard. Profile Synchronization does not work on a stand-alone installation for SharePoint Server 2010 Beta."
I have initiated the thread in MSDN forums here and still that is growing. User profile import
But, there are some configurations we need to check before do the user profile import. One of the important notes is "The farm is running either the Standard or Enterprise version of SharePoint Server 2010 and you have run the farm configuration wizard. Profile Synchronization does not work on a stand-alone installation for SharePoint Server 2010 Beta."
JQuery conflict when using different javascript libraries
Today, I came to a scenario where I need to use JQuery and Prototype libraries in my application. Both are operating with $() to access the objects and do the client side logic. But, the $() is getting conflicted between JQuery and Prototype libraries and things got messed up. So, it should be a good practice to distinguish them because who knows what requirements come in future and how many client side javascript technologies we are going to use. The code which we have shouldn't effect anything, right?.
The same thing happen in my SharePoint sites too. When I tried to migrate from SharePoint 2007 to SharePoint 2010, the client side script [JQuery] custom developed is not working. The only reason behind is the conflicts in the javascript. The file SP.js in the SharePoint 2010 causing the problem.
So, make sure, if you have used JQuery in your applications, always the best practice is declare the Jquery global instance variable and then start using that instead of directly use the $(). For example,
Hope you like this post and love to hear comments.
The same thing happen in my SharePoint sites too. When I tried to migrate from SharePoint 2007 to SharePoint 2010, the client side script [JQuery] custom developed is not working. The only reason behind is the conflicts in the javascript. The file SP.js in the SharePoint 2010 causing the problem.
So, make sure, if you have used JQuery in your applications, always the best practice is declare the Jquery global instance variable and then start using that instead of directly use the $(). For example,
var $j = jQuery.noConflict(); // Use jQuery via $j(...) $j(document).ready(function(){ $j(".someclass").hide(); });So, in the above code, we actually referring the $j() instead of directly $(), so it won't give any problems in future. No matter what how many different client side javascript technologies used, that should work. For more information check it here.
Hope you like this post and love to hear comments.
Monday, February 15, 2010
SharePoint Exception: No item exists [url]. It may have been deleted or renamed by another user.
This is one of the exception regularly comes when we do custom development and create custom aspx pages. Everything works fine and no code issues but still this exception comes. I worked hard to fix this problem so long time. Tracked everything like logs, event viewer and more tips. Nothing helps. Then spent some nice time and trail and error methods found the problem and fixed.
More details about exception:
No item exists at http://mysharepointsite/Pages/Home.aspx?id=4&q=HQ. It may have been deleted or renamed by another user.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: Microsoft.SharePoint.SPException: No item exists at http://mysharepointsite/Pages/Home.aspx?id=4&q=HQ. It may have been deleted or renamed by another user.
More details about exception:
No item exists at http://mysharepointsite/Pages/Home.aspx?id=4&q=HQ. It may have been deleted or renamed by another user.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: Microsoft.SharePoint.SPException: No item exists at http://mysharepointsite/Pages/Home.aspx?id=4&q=HQ. It may have been deleted or renamed by another user.
SharePoint Exception: Coercion Failed: Input cannot be null for this coercion
This is the exception, I am seeing very first time in SharePoint development. What I tried was, through SharePoint designer I tried to update the list item. The source and destination lists are having a field of type choice. I want to grab the choice field information from source list and update the destination list choice field.
The problem occurs only when the source choice field is empty.
More clearly, I have a list with checkbox list field. When a new list item is added, the workflow triggers and start updating the another list item with the current item information. And when I select nothing in the checkbox list field, then it throws the exception "SharePoint Exception: Coercion Failed: Input cannot be null for this coercion".
So, why the problem comes?
Because in update list item phrase in SharePoint designer I have selected the lookup for choice Return field as as Choices, Comma delimited. See the below screenshot.
Once changed that back to the As String then everything worked perfect. But, didn't get the reason behind. When nothing selected, then it shouldn't do any operation. It should check for null and do nothing. May be a built-in problem or something interesting with this.
Hope this helps to understand it well and solve your problem.
The problem occurs only when the source choice field is empty.
More clearly, I have a list with checkbox list field. When a new list item is added, the workflow triggers and start updating the another list item with the current item information. And when I select nothing in the checkbox list field, then it throws the exception "SharePoint Exception: Coercion Failed: Input cannot be null for this coercion".
So, why the problem comes?
Because in update list item phrase in SharePoint designer I have selected the lookup for choice Return field as as Choices, Comma delimited. See the below screenshot.
Once changed that back to the As String then everything worked perfect. But, didn't get the reason behind. When nothing selected, then it shouldn't do any operation. It should check for null and do nothing. May be a built-in problem or something interesting with this.
Hope this helps to understand it well and solve your problem.
Friday, February 12, 2010
Declarative workflows cannot automatically start if the triggering action was performed by System Account
This is the exception came to me today when I try to run a workflow on a list when an item is created. I tried different combination and didn't get the problem resolved. Even I removed all workflow conditions and actions and placed a simple update like update the title of the item in workflow body. Still that didn't give me the result. The workflow is not starting at all automcatically.
After some research found that, when we are using system account [With the account we installed SharePoint], the workflows won't run automatically. This is looking crazy but that is what the problem. When I try to run them manually, then they are running absolutely fine, but they aren't starting automatically.
When I try to login with another account other than system account, no problems. Workflow starts automatically. The only reason is "if we install SP1 package, then declarative workflows can no longer be triggered by the SharePoint System account" as there is the possibility of security vulnerability. So, they didn't give access to run the declarative workflows under the System account.
So, friends, if you face any type of these problems make sure you login with some other account other than system account. Hope this helps to save at least 2-3 hours of time.
After some research found that, when we are using system account [With the account we installed SharePoint], the workflows won't run automatically. This is looking crazy but that is what the problem. When I try to run them manually, then they are running absolutely fine, but they aren't starting automatically.
When I try to login with another account other than system account, no problems. Workflow starts automatically. The only reason is "if we install SP1 package, then declarative workflows can no longer be triggered by the SharePoint System account" as there is the possibility of security vulnerability. So, they didn't give access to run the declarative workflows under the System account.
So, friends, if you face any type of these problems make sure you login with some other account other than system account. Hope this helps to save at least 2-3 hours of time.
Team Explorer 2008 and TFS 2010
Can we connect to TFS 2010 from Team explorer 2008? This is the question to most of the people who want to use TFS 2010, but, they don't have VS 2010 installed by chance. So, no need to bother. Visual studio 2008, Team explorer 2008 supports it and you can connect to 2010 TFS server. But, you need to install one package for the forward compatibility for VSTS 2008 version. You can download it here.
Visual Studio Team System 2008 Service Pack 1 Forward Compatibility Update for Team Foundation Server 2010 (Installer)
But, before you install it, make sure you have installed the VS SP1 and Team Explorer SP1.
Visual Studio SP1 and Team Explorer SP1
Before you install anything, please read the article to avoid problems.
Installation order of packages
That's it!!!
Visual Studio Team System 2008 Service Pack 1 Forward Compatibility Update for Team Foundation Server 2010 (Installer)
But, before you install it, make sure you have installed the VS SP1 and Team Explorer SP1.
Visual Studio SP1 and Team Explorer SP1
Before you install anything, please read the article to avoid problems.
Installation order of packages
That's it!!!
Monday, February 8, 2010
ASP.NET Checkbox click on label calling click event twice in JQuery
I don't know this is a known issue in Mozilla Firefox browser. When I use ASP.NET checkbox on a web page, it will render as a input control plus label. So, when I click on checkbox or label the click event raises and checkbox state changes. But, I figured out a strange behavior. When I click on the label the click event is raising twice when I use JQuery [I didn't try with javascript]. But, where as when I click on checkbox it is raising click event only once. How to solve this problem? I have tried so many ways to solve the problem. But, didn't success.
I have tried by using type of the control. If type is checkbox then only go inside or just do nothing. When I click on label, it is coming to click event and every time, all lines are executing. I don't know why this is happening. Wheat I understood is, when we click on label then internally it is again generating click event for the checkbox because of the label for attribute. So, take care of it.
And if you find any solution to this problem, please let me know.
I have tried by using type of the control. If type is checkbox then only go inside or just do nothing. When I click on label, it is coming to click event and every time, all lines are executing. I don't know why this is happening. Wheat I understood is, when we click on label then internally it is again generating click event for the checkbox because of the label for attribute. So, take care of it.
And if you find any solution to this problem, please let me know.
JQuery 1.4.1 released
It's a good news for all JQuery lovers. The latest version of JQuery 1.4.1 has been released and getting very popular. Personally, I feel very good. The secret of success this version is the performance improvement, some changes to existing methods and new additions. This is very nice to know the functions are executing less time than they were.
http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js
They have made plenty of changes to setter, getter and ajax methods.
The whole API changes are documented here.
http://api.jquery.com/category/version/1.4/
Why to wait, get the latest version and start playing with it.
- jQuery Minified (23kb minified version.)
- jQuery Regular (154kb regular version)
http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js
They have made plenty of changes to setter, getter and ajax methods.
The whole API changes are documented here.
http://api.jquery.com/category/version/1.4/
Why to wait, get the latest version and start playing with it.
JQuery live() method for Focus and Blur
Everyone knows these days we are liking the client side implementation as much as we can. That is the only reason why all the client side languages are more popular. In Jquery, Live() method is very nice concept and as we know it is not supporting all the events. [Hope in version 1.4.* it is coming.] I had a requirement to raise an event when user goes away from the input control and that input controls are dynamically generated. But, as we know, we don't have live() method support for blur and focus events, we need to simulate or write our own. Below is the best way to implement that.
http://stackoverflow.com/questions/1199293/simulating-focus-and-blur-in-jquery-live-method
This is very easy and simple to understand. The same way, we can implement the other events we needed. Hope this helps and will do much with JQuery.
http://stackoverflow.com/questions/1199293/simulating-focus-and-blur-in-jquery-live-method
This is very easy and simple to understand. The same way, we can implement the other events we needed. Hope this helps and will do much with JQuery.
Friday, February 5, 2010
SharePoint Querying - CAML Query usage when special characters in DATA
We have many ways of pulling information from SharePoint sites. Depends on the requirements we may use web services or using SharePoint object model. If you have requirement to filter data from a SharePoint list then the best option is through CAML queries we will write a simple query and run it against the SharePoint list and get the collection of data. So, if you are familiar with CAML queries then no need to say how to write and how they will execute. But, this post main focus is on what if the data which you are querying contains the special characters like '&'. The query won't run and it fails. Take the example of below code.
I think, by seeing above syntax, you may get the answer. :). What I did is, we are familar with XML and we know how to handle special characters in XML[Using <![CDATA[Some DATA]]>]. So, I used the same logic here and everything started working as expected.
**UPDATED**
From the comments, I found a special scenario of why it fails even we use CDATA. Check it below.
http://social.technet.microsoft.com/Forums/en-US/sharepointdevelopment/thread/8b442d22-eb56-40d8-a487-a325d3a70626/
I am trying to solve this, but for now, the only solution is through encode it and query it.
Please let me know, your ideas on it.
<Where><Contains><FieldRef Name='Description' /><Value Type='Note'>Praveen&Battula</Value></Contains></Where>The above query will leads to errors and you see the error in the logs. So, what is the problem? There are no syntax errors and everything is perfect. But, where is the problem? The problem is as we discussed the symbol '&' in the data [Praveen&Battula]. So, how to solve this problem? Below is the simple solution.
<Where><Contains><FieldRef Name='Description' /><Value Type='Note'><![CDATA[Praveen&Battula]]></Value></Contains></Where>
I think, by seeing above syntax, you may get the answer. :). What I did is, we are familar with XML and we know how to handle special characters in XML[Using <![CDATA[Some DATA]]>]. So, I used the same logic here and everything started working as expected.
**UPDATED**
From the comments, I found a special scenario of why it fails even we use CDATA. Check it below.
http://social.technet.microsoft.com/Forums/en-US/sharepointdevelopment/thread/8b442d22-eb56-40d8-a487-a325d3a70626/
I am trying to solve this, but for now, the only solution is through encode it and query it.
Please let me know, your ideas on it.
Monday, February 1, 2010
SSRS Reports get Month name from Month Index or from date
This is one of the small tips which I want to tell my readers. When you work with SSRS reports, you may come across with the requirement like, you know the index of the month, but you want to print month name from it. So, if that is the situation for you, this is the right post for you. :)
But in SSRS reports the way you need to approach is like this.
In any case, you need to get it by date then you still use this below function.
Hope this helps and please let me know, if you face any problems.
MonthName(monthindex)You may get it from t-SQL as I mentioned in my previous post here.
But in SSRS reports the way you need to approach is like this.
- Take a textbox to report body.
- Write the below syntax into it [As you know, it is the expression].
In any case, you need to get it by date then you still use this below function.
=MonthName(Month(Fields!datefield.Value))
Hope this helps and please let me know, if you face any problems.
Subscribe to:
Posts (Atom)