Showing posts with label Error. Show all posts
Showing posts with label Error. Show all posts

Friday, April 6, 2012

SharePoint Resource file issues

Scenario:
Working on some of the recent projects I faced some weird Resource file based issues. Actually these errors shows up during Feature activation. So doing a quick post on workarounds that worked for me.Leave comments if you found a more appropriate answer

Error type (1):
Failed to read resource file "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\Template\Features\myProject_SiteFeature\Resources\Resources.en-US.resx" from feature id "GUID".

Failed to open the file 'C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\Template\Features\myProject_SiteFeature\Resources\Resources.en-US.resx'.

What I did: After googling / investigating my logs with Error co-relation ID , I realized that these can be skipped. Real cause of this error is something else and will recommend to start analyzing the logs from oldest to newest. Doing so I was able to find the real cause of the issue.

Error type (2):
Failed to find resource file "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\Resources\myProjectResources.en-US.resx" from feature id "GUID".

What I did: In my project I was using "myProjectResources.resx" file but it was looking for "myProjectResources.en-US.resx", which is weird. To fix the issue, I create a copy of existing "myProjectResources.resx" file and redeployed. It worked for me.

Wednesday, January 18, 2012

SharePoint Error activating feature

Scenario:
Got an error while activating feature.
Object reference not set to an instance.

Also break point was not hitting the Feature Receiver code while debugging.

Solution:
Few things I tried before I found the real cause.

1. Commented the code and tried, still same error

2. Removed the Element manifest and tried, still same error

3. Checked the feature dependency. This was the culprit. Remove feature dependency resolved the issue.

Sunday, January 15, 2012

Microsoft.Reporting.WebForms.ReportViewer is not compatible

Scenario:
While integrating ReportViewer 10.0.0.0 with SP2010 I faced an old issue

The base class includes the field 'ReportViewer1', but its type (Microsoft.Reporting.WebForms.ReportViewer) is not compatible with the type of control (Microsoft.Reporting.WebForms.ReportViewer).

As I hate to get into same problem again. Here's a list of things I tried to make it work.

Solution:
To understand the issue its a version mismatch issue. Check what's the latest version of ReportViewer ( Microsoft.Reporting.WebForms.dll) you have. On SP2010, its 10.0.0.0

If you are using any lower version i.e. 8.0.0.0 or 9.0.0.0 then you need to update it all places to avoid this.

Steps:
1. Check to make sure you don't have @Register directive pointing to old version. This you can do by searching '9.0.0.0' or '8.0.0.0' in complete project.

2. Clean the VS2010 solution and rebuild

3. Remove binary reference from Visual Studio project and add it again. Try Building it again

4. Check web.config to find you don't have entries pointing to old versions.

5. Sometime closing Project and opening it again helps

6. IISReset to ensure there are no caching issues with old versions

Wednesday, November 16, 2011

Microsoft.Silverlight.CSharp.targets was not found

Scenario:
Opened an old silverlight project and got following error.

The imported project "C:\Program Files (x86)\MSBuild\Microsoft\Silverlight\v4.0\Microsoft.Silverlight.CSharp.targets" was not found. Confirm that the path in the <import> declaration is correct, and that the file exists on disk.

Solution:
1. Download Silverlight4_Tools from MS Web site and install it

2. Close VS 2010 and start again to load the project

SharePoint sending email to random people

Scenario:
I have noticed a small data corruption in out farm. SharePoint is sending email to random people in some cases.

Steps to reproduce

1. Create a new task list
2. Edit the "Assigned To" to support multiple users ( By default only one user can be assigned a particular task )
3. Create a new task – Now assign say User 1 , User 2
4. Email will be sent to both the users
5. Edit the task and change the assign to say User1,User 3
6. When you inspected the email received by User1/User 3 , it has some random names also

Solution:
MS recommend one hotfix described by KB 948945, or a later cumulative update or SP. In the meantime, the defined workaround is:

Turn off the multiple selection option
Or
Install the hotfix from Microsoft.

KB article description:
On a SharePoint Server 2007 site, you modify a task in a task list. When you do this, users other than the users who are assigned to the task receive the notification e-mail message for the change.

Monday, October 31, 2011

Error in Activate Features from Visual Studio

Scenario:
I was re-deploying a solution from Visual Studio. My solution had custom Fields / Content Type declarations and was getting deployed to an existing site collection.

I noticed following errors :

Error occurred in deployment step 'Activate Features': The field with Id {GUID} defined in feature {GUID} was found in the current site collection or in a subsite.

OR

Error occurred in deployment step 'Activate Features': The content type with Id {GUID} defined in feature {GUID} was found in the current site collection or in a subsite.

Reason:
First of all this is not a problem with Solution. As if you use STSADM / Powershell to deploy and activate features, it will work fine.

Actually there is something going on with VSSPHost4 process.

Solution:
There are 2 solutions to this issue.

1. Close the Visual Studio and start again :)

2. Kill VSSPHost4 process. This can be done from SharePoint Powershell Management shell command prompt

stop-process -processname vssphost4 -force

Tuesday, July 26, 2011

Failed to associate this workflow template with a Microsoft Office SharePoint list

Scenario:
I have been building and deploying my Sharepoint Sequential Workflow with no issues.

Now I started to get following error: output details are as below

Successfully installed this assembly into the global assembly cache: CustomWF.dll.
Successfully restarted Internet Information Services (IIS).
Successfully copied workflow.xml to C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\TEMPLATE\FEATURES\CustomWF\workflow.xml.
Successfully copied feature.xml to C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\TEMPLATE\FEATURES\CustomWF\feature.xml.
Successfully installed the workflow template to Microsoft Office SharePoint Server.
Failed to associate this workflow template with a Microsoft Office SharePoint list. Object reference not set to an instance of an object.
Failed to deploy the workflow template to Microsoft Office SharePoint Server.
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
========== Deploy: 0 succeeded, 1 failed, 0 skipped ==========


Solution:
While I was not to totally find the real cause of the issue but did a workaround to move forward.

Steps:
1. Created folder structure 12\TEMPLATE\FEATURES\CustomWF
2. Moved the feature.xml inside the folder
3. Moved the element.xml inside the folder
4. Build WSP using WSPBuilder

Article:
Open issue

Friday, May 20, 2011

Missing values of one column in list item

Scenario:
Today working on MOSS 2007 project, Adil - my team member mentioned that he is facing a weird behaviour with OOTB sharepoint list. One of the column in the list is not showing value, even though value does exist for that column.

He was getting blank in Display mode and also in ListView mode.
Values are showing up for Admin user but for all other users it's showing blank.

Strange, isn't it ?

Analysis:
I started analyzing whats so different with this list and I realized we had so many number columns. Is that an issue ??

Yes , that can be.

As we know SharePoint database is not simple and uses a big table to store all the values. When we create a new column , say type Number , it will look into the datarow and allocate a number column to it , i.e. numbercolumn1. Now there is a limited number of columns in datarow for each type. If we already consumed all the columns for other fields then only way to accomodate it is 'Row-wrap'.
Yes , you are right. It will book an another row for each item u create.

All that is fine but how it is connected to above issue ??

I opened SharePoint manager to checked the details of each field. While all the fields which are working file had RowOrdinal="0" , the field showing blank had RowOrdinal="1".

Conculsion:
SharePoint is limited by design and sometime not able to pull the information back from wrapped rows/columns.

Workarounds:
1. Just like good DB normalization technique, split the data in 2 lists.
2. Look for columns you really don't need. If 'Row-wrap' is because of 1-2 columns, you might be able to remove them to ensure you don't cross columns maximum limitation.

Article:
Check out
Column Limitation for MOSS 2007

Saturday, April 30, 2011

The DataSourceID of 'TopNavigationMenu' must be the ID of a control of type IHierarchicalDataSource

Scenario:
We installed a new solution and now when we navigate to our site collection, it simply throws this error.

The DataSourceID of 'TopNavigationMenu' must be the ID of a control of type IHierarchicalDataSource. A control with ID 'topSiteMap' could not be found.

Solution:
While I didn't really got a change to debug the real cause, I thought of sharing what I did to fix it

1. Navigate to web application folder , usually it is @ c:\inetpub\wwwroot\wss\virtualdirectories\80

2. Look for the last backed up web.config [ IIS automatically backs' up web.config files before any change.

3. Restore this web.config

That's all and it worked.

Thursday, April 28, 2011

SharePoint Designer Workflow publish error

Scenario:
I was working on a small POC Workflow but as there were new ideas I keep adding more steps to my workflow.

Workflow was saving fine and was not getting any error when I do error validation
but All of sudden started getting below error when Publishing my WF.

Error were found when compiling the workflow. The workflow files were saved but cannot be run.

Advanced: Unexpected error on server associating the workflow


wferror

Possible Reason(s):
As I was not getting any error while error validation using SPD, I realized its something to do with SPD --> Web Application communication.

Another thing I noticed that I was able to publish small Workflow but I was getting error on only big once. So I guess it was request size / timeout related issue.

Solution:
Increase the web application execution time

Steps:
1. Navigate to web.config file of the WebApplication
Usually its @ C:\inetpub\wwwroot\wss\VirtualDirectories\xxxx\web.config

2. Look for this

<httpRuntime maxRequestLength="51200" />
3. Replace with
<httpRuntime maxRequestLength="51200" executionTimeout="300" />
That's all

Thursday, February 24, 2011

Collection was modified enumeration operation may not execute

Scenario:
I was writing a small SharePoint utility and was in rush for my next meeting.
When I ran my utility to test the first cut. I got the following error.

Error : [System.InvalidOperationException] = {"Collection was modified; enumeration operation may not execute."}

Code was like this

 foreach (SPListItem item in sourceList.Items)
{
if(item["Title"]!="blah")
{
item["Title"] = "blah blah blah ";
// Some more code
item.Update();
}
}
Reason:
While the error message is pretty clear and is not specific to SharePoint, I thought of posting. As you see I am looping through the ListItem Collection and modified the item itself which re-arranged the Collection itself. So next time SharePoint loop to get next item, you will encounter the above error.

Solution:
There can be 'n' solutions for this but this is what I did to fix it.
While looping I didn't modify the item but only copied its ID in a List and added an extra looping to get the items by ID and then modify the Item.

Modified Code:
 List<int> itemIDs = new List<int>();
foreach (SPListItem item in sourceList.Items)
{
if(item["Title"]!="blah")
{
itemIDs.Add(listItem.ID);
}
}

foreach (int i in itemIDs)
{
item["Title"] = "blah blah blah ";
// Some more code
item.Update();
}

Thursday, July 29, 2010

Error copying reusable workflow

Scenario:
SharePoint has reusable workflows newly introduced in SP2010. Using SPD you can also modify existing workflows to fit your requirements.

Today I asked my collegue to work on a task which required to reuse an OOTB workflow. But when she click on 'Copy & Modify' button from the ribbon. She keep getting following errors:

This workflow is readonly. Would you like to make a copy of this workflow to open or edit ?
error1

On saying Yes , you get 'Server could not complete your request.For more specific information, click the Details button.'
error2

Solution:
SharePoint will continue to be popular for its weird error message. As in this case.. no error message :)

One of the reason this can happen is if you are working on a sub-site of site collection.

Switch to RootWeb of the site collection and using SharePoint Designer try copying the Workflow, it will work.

Saturday, July 10, 2010

Silverlight webpart drag and drop not working

Scenario:
I wrote a new Silverlight webpart and was using Drag and Drop functionality. But as soon as I use this inside share point, drag and drop stopped working.

Solution:
As I was using OOTB Silverlight webpart to load the XAP. Silverlight webpart set Windowless property to TRUE by default and this is what caused the issue.

So I exported the exisiting ootb webpart definition DWP file on desktop, edited the Windowless property to False and uploaded the webpart again and it works.

Also you can copy the below XML into a DWP file and upload it to sharepoint.

silverlightdragdrop

Code ( Silverlight_WindowLess_Webpart.dwp ):

<webParts>
<webPart xmlns="http://schemas.microsoft.com/WebPart/v3">
<metaData>
<type name="Microsoft.SharePoint.WebPartPages.SilverlightWebPart, Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" />
<importErrorMessage>Cannot import this Web Part.</importErrorMessage>
</metaData>
<data>
<properties>
<property name="HelpUrl" type="string" />
<property name="AllowClose" type="bool">True</property>
<property name="ExportMode" type="exportmode">All</property>
<property name="Hidden" type="bool">False</property>
<property name="AllowEdit" type="bool">True</property>
<property name="Direction" type="direction">NotSet</property>
<property name="TitleIconImageUrl" type="string" />
<property name="AllowConnect" type="bool">True</property>
<property name="HelpMode" type="helpmode">Modal</property>
<property name="CustomProperties" type="string" null="true" />
<property name="AllowHide" type="bool">True</property>
<property name="Description" type="string">A web part to display a Silverlight application.</property>
<property name="CatalogIconImageUrl" type="string" />
<property name="MinRuntimeVersion" type="string" null="true" />
<property name="ApplicationXml" type="string" />
<property name="AllowMinimize" type="bool">True</property>
<property name="AllowZoneChange" type="bool">True</property>
<property name="CustomInitParameters" type="string" null="true" />
<property name="Height" type="unit">300px</property>
<property name="ChromeType" type="chrometype">Default</property>
<property name="Width" type="unit">400px</property>
<property name="Title" type="string">Silverlight Web Part</property>
<property name="ChromeState" type="chromestate">Normal</property>
<property name="TitleUrl" type="string" />
<property name="Url" type="string"></property>
<property name="WindowlessMode" type="bool">False</property>
</properties>
</data>
</webPart>
</webParts>

Thursday, May 27, 2010

Silverlight security error connecting SharePoint

Scenario:
Wrote a small Silverlight application which was trying to display the title of the site using Client Object Model and to my surprise I got the following error :

{System.Security.SecurityException ---> System.Security.SecurityException: Security error.
at System.Net.BrowserHttpWebRequest.InternalEndGetResponse(IAsyncResult asyncResult)
at System.Net.BrowserHttpWebRequest.<>c__DisplayClass5.
b__4(Object sendState)
at System.Net.AsyncHelper.<>c__DisplayClass2.
b__0(Object sendState)
--- End of inner exception stack trace ---
at System.Net.AsyncHelper.BeginOnUI(SendOrPostCallback beginMethod, Object state)
at System.Net.BrowserHttpWebRequest.EndGetResponse(IAsyncResult asyncResult)
at System.Net.WebClient.GetWebResponse(WebRequest request, IAsyncResult result)
at System.Net.WebClient.OpenReadAsyncCallback(IAsyncResult result)}


Solution:
This can be because of few reasons

1. Make sure the web URL used to create the Client context object exist and brows-able.

2. This might be because of missing client policy access file missing for the SharePoint Web Application not allowing you to connect. Create a new XML file named ClientAccessPolicy.xml with content below and save it to 'C:\inetpub\wwwroot\VirtualDirectories\80'

Note : Update policy file and port number as needed.

ClientAccessPolicy.xml:

<?xml version="1.0" encoding="utf-8" ?> 
<access-policy>
<cross-domain-access>
<policy>
<allow-from http-request-headers="*">
<domain uri="*" />
</allow-from>
<grant-to>
<resource path="/" include-subpaths="true" />
</grant-to>
</policy>
</cross-domain-access>
</access-policy>
Once you have the file copied to right location, do an IISReset and make sure you can access the file using following url :

http://servername:portno/clientaccesspolicy.xml
Note
This setting is only for Development Environment. Read the following article how to tweak the policy file for production environment.

Article:MSDN

Friday, May 21, 2010

SharePoint 2010 Console Application threw FileNotFoundException was unhandled

Scenario:
My colleague called me and asked to look for the error she was getting in her first SharePoint 2010 Console Application.

The Web application at http://demo/ could not be found. Verify that you have typed the URL correctly. If the URL should be serving existing content, the system administrator may need to add a new request URL mapping to the intended application.

Solution:
Simple solution, Check to make sure thats Build Target for the Project is x64 and not x86 which is default setting.

1. Right Click the Project Node > Properties
2. Under Build tab > Target should be x64

Also make sure thats there is a site collection at the url you are specifying to create SPSite object

Tuesday, May 11, 2010

The formula refers to a column that does not exist

Scenario:
While working with calculated column I got the following error,

The formula refers to a column that does not exist. Check the formula for spelling mistakes or change the non-existing column to an existing column. at Microsoft.SharePoint.Library.SPRequestInternalClass.CallCalcEngine(Int32 operation, String bstrUrl, String bstrListName, String bstrString1, String bstrString2)
at Microsoft.SharePoint.Library.SPRequest.CallCalcEngine(Int32 operation, String bstrUrl, String bstrListName, String bstrString1, String bstrString2)


Here's the formula I had, which got saved without an issue
=IF([ShowLastUpdated],[Modified],)

But when I opened the same column in edit mode and tried saving it again and got the error. On closer look I found the formula is changed to

=IF(ShowLastUpdated,Modified,) where all braces were missing.

Solution:
Adding the brackets again around the columns solved the issue. This is certainly a bug.Also when i tried with a simple formula ( =Modified ) , I didn't find this issue.

Tuesday, February 16, 2010

Indirect dependency on the framework assembly System.Web.DataVisualization

Scenario:
You are getting the following one or more such ERROR while compiling the solution

The type or namespace name 'Office' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?

The type or namespace name 'Publishing' does not exist in the namespace 'Microsoft.SharePoint' (are you missing an assembly reference?)

The type or namespace name 'ServerContext' does not exist in the namespace 'Microsoft.Office.Server' (are you missing an assembly reference?)


You are getting the following WARNING while compiling the solution

The primary reference "Microsoft.Office.Server, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c, processorArchitecture=MSIL" could not be resolved because it has an indirect dependency on the framework assembly "System.Web.DataVisualization, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" which could not be resolved in the currently targeted framework. ".NETFramework,Version=v3.5". To resolve this problem, either remove the reference "Microsoft.Office.Server, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c, processorArchitecture=MSIL" or retarget your application to a framework version which contains "System.Web.DataVisualization, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35".

Solution:
Actually as you have not added the binary reference for "System.Web.DataVisualization", visual studio is trying to pick the latest version from GAC. When it is not found you are getting this warning

So let's help visual studio finding this binary and that will take away this warning.

1. Right click the project and Add a reference
2. Navigate to "c:\Program Files (x86)\Microsoft Chart Controls\Assemblies\System.Web.DataVisualization.dll"

That's it

Thursday, January 7, 2010

UserProfileException : the request channel timed out

Scenario:
I for this error when running configuration wizard one time and other time while configuring the SharePoint User Profile Synchronization within SharePoint 2010 Beta.

An exception of type Microsoft.Office.Server.UserProfiles.UserProfileException was thrown. Additional exception information: The request channel timed out while waiting for a reply after 00:00:59.9980468. Increase the timeout value passed to the call to Request or increase the SendTimeout value on the Binding. The time allotted to this operation may have been a portion of a longer timeout.


Microsoft.Office.Server.UserProfiles.UserProfileException: The request channel timed out while waiting for a reply after 00:00:59.9980468. Increase the timeout value passed to the call to Request or increase the SendTimeout value on the Binding. The time allotted to this operation may have been a portion of a longer timeout.

err

Solution:
Install following hotfixes and re-boot the server without fail.

Download available here:
KB971831 - Windows Server 2008 Service Pack 2, Windows Vista Service Pack 1 or Windows Vista Service Pack 2

KB976462 - Windows Server 2008 R2 and Windows 7

Some or all identity references could not be translated.

Scenario:
While installing sharepoint 2010 , I got the following error

Error : An exception of the type System.Security.Principal.IdentityNotMapped was thrown. Additional exceptiomn information : Some or all identity references could not be translated.

Basically I got this error after removing the Active Directory Role from the server while running the configuration wizard.

err

Solution:
I dont think there is an easy way to get rid of this error. So In my opinion options are
1. Re-install the OS and then proceed.
2. Re-install sharepoint 2010.

Wednesday, January 6, 2010

Exception of type Microsoft.Office.Server.UserProfiles.UserProfileException

Scenario:

Failed to create sample data.
An exception of type Microsoft.Office.Server.UserProfiles.UserProfileException was thrown. Additional exception information: Unrecognized attribute 'allowInsecureTransport'. Note that attribute names are case-sensitive. (C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\WebClients\Profile\client.config line 56)


ds

Solution:
Install following hotfixes and re-boot the server

Download available here:
KB971831 - Windows Server 2008 Service Pack 2, Windows Vista Service Pack 1 or Windows Vista Service Pack 2

KB976462 - Windows Server 2008 R2 and Windows 7