Showing posts with label Exception. Show all posts
Showing posts with label Exception. Show all posts

Operation is not valid due to the current state of the object when making changes to SPListItem object using elevated previliges

This is known error to sharepoint developers that when try to update/delete a SharePoint list item using system account. Means using SPSecurity.RunWithElevatedPrivileges() method. I am not sure, why it is not allowing to update or delete a file in this code block. But, there is work around for it. You can still edit the item using elevated privileges. Here is a wonderful post, which helped me great and all credits to him.
Make changes to SPListItem using elevated privileges
I am really surprised by seeing the code in his article. It is completely unexpected and it is working great. I am really not believed when I saw the code very first time, but it is working.

But, make sure you are disposing the objects correct. Hope this will help you too to fix the problem "Operation is not valid due to the current state of the object". Read More...

UserProfileServiceUserStatisticsWebPart:LoadControl failed - SharePoint 2010 Exception

Today, when I installed the SharePoint 2010 server, First task I want to complete is user profile import. Everyone knows that there was a big bug in the BETA version in this module. So, I went there in manage services screen and clicked the "User Profile Synchronization Service". Surprisingly I got the error screen and don't know what to do. That is unspecified error screen and not given any error details.
But, we have an excellent resource to solve all these issues. I mean SharePoint Log files. When I went there and looked into the file, I found below exception message.

UserProfileServiceUserStatisticsWebPart:LoadControl failed, Exception: System.IO.FileLoadException: The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)     at Microsoft.Office.Server.UserProfiles.UserProfileConfigManager.InitializeIlmClient(String ILMMachineName, Int32 FIMWebClientTimeOut)     at Microsoft.Office.Server.UserProfiles.UserProfileConfigManager..ctor(UserProfileApplicationProxy userProfileApplicationProxy, Guid partitionID)     at Microsoft.SharePoint.Portal.WebControls.UserProfileServiceStatisticsWebPartBase.LoadControl(Object sender, EventArgs e)    74edaea3-11cb-44a8-af6b-b8dad2876437

Time god, I knew this issue earlier that there are couple of chances why it's coming.
  1. Check once that the Forefront Identity Manager Synchronization Service and the Forefront Identity Manager Service are running [Go to services and check].
  2. If Central Administration and the User Profile Synchronization service are provisioned on the same server then you should do IISRESET after started the service.
In my case, the problem was #1. After I started them and IISRESET everything started working fine. Read More...

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:
  1. Doing an IISRESET solving the problem but it is solving temporarily.
  2. Open IIS and go to your SharePoint site. And find the application pool.
  3. Go to application pool, click Advanced settings, change the value for "Load User Profile" to "true".
That's it!!! You are done.
Special thanks to Bassem Georgi for the nice tip. Read More...

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.

Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. 

What's the problem?
The problem is in my custom ASPX page, I am using a querystring with the key "id". Do you believe this? which is causing the problem?

Yes, 100% sure. This is what causing the problem. This problem came in  my two successive SharePoint projects and finally by changing the querystring key from id to someother key named like "sid" or "aid" or something other than "id" worked.

I am not really 100% sure what's happening when I use "id" key in the querystring, but by changing that everything works fine. So, don't use the querystring "id" in your cusotm SharePoint ASPX pages.

Note: There are chances that you may think the page is checked out or removed by some other user, then that's a mistake.

Hope this helps and save you from killing so much time to know the problem. Read More...

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. Read More...

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. Read More...

Request format is unrecognized for URL unexpectedly ending in methodname

This is the exception I am getting when I try to access web services from my web site. I just created a web service and tried to access the service from the browser using the get request. But I got the invalid operation exception. See complete exception details below:

System.InvalidOperationException: Request format is unrecognized for URL unexpectedly ending in '/MethodName'

So, Before we will go to know the solution for it, I want to explain the reason behind this.

A .NET web service supports three protocols named HTTPGET, HTTPPOST and SOAP. When .NET released I mean, ASP.NET v1.0 all these three protocols enabled by default. So, any requests which made from the browser which belongs to a web service will be responded without any issues. But when come to ASP.NET 1.1 version the protocols HTTPGET and HTTPPOST are disabled by default. The only reason is SECURITY issue. So until you explicitly enable them no web service request will be processed if you call them in the format domain/webservice.asmx/methodname [Get/Post].

But, where as if you call direct web service from browser using SOAP request that will work and will give result what you need. But, if you make any GET or POST request then only the problem will come. 

RESOLUTION:

To enable these protocols in the application level simply we need to change the application config file. Web.config. Add below lines to the web.config to enable these protocols.











So, this webservices tag will go inside the <system.web> namespace. With the above lines, the protocols enabled and they listen the request and respond accordingly for that application. Sometimes you may need to enable these protocols in system level. I mean to all applications in the server should have these protocols enabled. Then below is the solution for it.

Find machine.config file and open it in nice editor like visual studio. Before do any changes please take a backup of the file. Now find the protocols section and add the below lines if they are not already there.






Hope, you understood it well and you are now knew the reason behind of the above exception message. Please know me the feedback.

Read More...

Could not load type Microsoft.TeamFoundation.WorkItemTracking.Client.workItemTypeDeniedOrNotExistException

This is the exception we are getting when we try to view the workitems from the Team explorer in visual studio. The problem is, you installed the team explorer after you installed the Visual studio 2008 SP1. Because of this, all the workitem related dll’s are not referenced correctly. And result is below exception message.image

Resolution:

To fix this issue, we just need to reinstall the visual studio sp1. So, the order should be

  • Visual Studio
  • Team Explorer
  • Visual Studio SP1

Hope this helps to the people who are facing the same issue.

Read More...
Related Posts with Thumbnails
GiF Pictures, Images and Photos