Showing posts with label Issue. Show all posts
Showing posts with label Issue. Show all posts

Wednesday, January 4, 2012

SharePoint Issues with HTML files

Scenario:
I have migrated few HTML files from MOSS Document Libraries to SP2010 Document Libraries. On click of these HTML files , I am getting a download file prompt.

In MOSS , there is no such issue. Click HTML file renders the file.

Reason:
SP2010 has restrictions on displaying or opening some files. This was not the case in MOSS 2007.

Solutions:
Revisit HTML files and try converting them to ASPX pages. This is highly recommended.

OR

From Central administration > Web Application General Settings > Check the "Browser File Handling" to "Permissive" for that web application. This does open some holes. Recommended only in intranet type scenario's.

Article:
Understand permissive option

Wednesday, November 16, 2011

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.

Tuesday, October 26, 2010

BCS Model not updated

Scenario:
I am working with a BCS Model and it is not picking up the change.

Solution:
While cache-ing is great for enterprise applications but sometime I hate it , specially during development , where we want to see the change with zero lag. Anyway I don't think so that's gonna happen. So we developers have our own tricks / steps to deal with it

Steps to Refresh BCS Model:
Assuming you are deploying using WSP package.

01. Retracted exisiting solution i.e. "myModel.wsp"
02. Navigate to BCS Service application and Deleted Model from everywhere
03. IISReset
04. Restarted "SharePoint Server Search 14" service
05. Deployed the new solution i.e. "myModel.wsp"
06. Navigate to BCS Service Application and add object permissions for your model
07. ( Optional ) Create/Upgrade the profile pages
08. Navigate to "Search Service Application" and re-crawl fully the Content Source using your Model
09. Once finished , Check the error log.
10. If all went smooth then checked the crawled properties, they should be there

Saturday, October 17, 2009

Folder Modified Date doesn't get updated

Scenario:
One of the bug in sharepoint folders is that they don't get updated when a new item inside the folder is added / updated. Modified Date of the folder will still show the old time stamp.

Solution:
I quickly wrote an Item Event Handler which can fix the time stamp for the item folder.

Code:

/// <summary>
/// Asynchronous after event that occurs after a new item has been added to its containing object.
/// </summary>
/// <param name="properties">
/// A Microsoft.SharePoint.SPItemEventProperties object that represents properties of the event handler.
/// </param>
public override void ItemAdded(SPItemEventProperties properties)
{
string listItemUrl = properties.ListItem.Url;
string temp = listItemUrl.Remove(listItemUrl.LastIndexOf('/'));
string folderName = temp.Substring(temp.LastIndexOf('/') + 1);

SPQuery query = new SPQuery()
{
Query = string.Format("<Where><And><Eq><FieldRef Name='ContentType' /><Value Type='Text'>folder</Value></Eq><Eq><FieldRef Name='Title' /><Value Type='Text'>{0}</Value></Eq></And></Where>",folderName),
RowLimit = 1
};

SPList list = properties.ListItem.ParentList ;
SPListItemCollection items = list.GetItems(query);

items[0].Update();
list.Update();
}
Note:
Right now this code will fix the Modified date of the folder only when a new item is added , so need to have the same code in Item updated if you want Folder modified date to be changed.

Also please test fully in case you have more than one level of folder structure.I think it will work but I haven't tested it.

Monday, October 12, 2009

Dataview webpart import issue

Scenario:
I use dataview web part very often and recently I faced a weird error.

Steps to reproduce error:
1. Add a ListView webpart
2. Go to SharePoint Designer and Convert to XSLT view
3. I just changed the layout to one of the options available in Display Tab of DataView properties.
4. Save the changes
5. Go to the page and Export the webpart
6. Now import the webpart on the same page.

Boom !!! Error : ViewFlag is not set to right value.

Solution:
While checking the Exported definition, I found this tag.

<ViewFlag xmlns="http://schemas.microsoft.com/WebPart/v2/ListView">9</ViewFlag>
1. Remove the previously added Webpart using Maintainance Page ( ?contents=1 )
2. Removed this tag altogether from the Export definition
3. Again imported it without issue.

Friday, October 2, 2009

The form cannot be displayed because session state is not available

Scenario:
You got the following error while associating a workflow that uses InfoPath form.

Error : The form cannot be displayed because session state is not available.

Solution:
Check you Web.config and Uncomment the Session tag in HTTPModules section like this

Before:

<httpModules>
<clear />
<add name="SPRequest" type="Microsoft.SharePoint.ApplicationRuntime.SPRequestModule, Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" />
<add name="OutputCache" type="System.Web.Caching.OutputCacheModule" />
<add name="FormsAuthentication" type="System.Web.Security.FormsAuthenticationModule" />
<add name="UrlAuthorization" type="System.Web.Security.UrlAuthorizationModule" />
<add name="WindowsAuthentication" type="System.Web.Security.WindowsAuthenticationModule" />
<add name="RoleManager" type="System.Web.Security.RoleManagerModule" />
<!-- <add name="Session" type="System.Web.SessionState.SessionStateModule"/> -->
<add name="PublishingHttpModule" type="Microsoft.SharePoint.Publishing.PublishingHttpModule, Microsoft.SharePoint.Publishing, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" />
</httpModules>
After:
 <httpModules>
<clear />
<add name="SPRequest" type="Microsoft.SharePoint.ApplicationRuntime.SPRequestModule, Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" />
<add name="OutputCache" type="System.Web.Caching.OutputCacheModule" />
<add name="FormsAuthentication" type="System.Web.Security.FormsAuthenticationModule" />
<add name="UrlAuthorization" type="System.Web.Security.UrlAuthorizationModule" />
<add name="WindowsAuthentication" type="System.Web.Security.WindowsAuthenticationModule" />
<add name="RoleManager" type="System.Web.Security.RoleManagerModule" />
<add name="Session" type="System.Web.SessionState.SessionStateModule"/>
<add name="PublishingHttpModule" type="Microsoft.SharePoint.Publishing.PublishingHttpModule, Microsoft.SharePoint.Publishing, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" />
</httpModules>

Wednesday, September 30, 2009

The solution file located at "xxxx.wsp" does not appear to be a valid upgrade

Scenario:
You got the following error while using the upgrade command with your updated solution file.

Error : The solution file located at "xxxx.wsp" does not appear to be a valid upgrade for solution "xxxx.wsp".
The two solutions must have the same resource types (global or Web-application scoped).


Reason:
This can be due to change in feature scope or addition of a new feature in the solution package from its previous version.

SharePoint is complaining by saying that the solution was either deployed Globally last time and this time you are trying to deploy it to a specific Url or the other way around.

Solution:
I will suggest to better retract/delete the old solution and add/deploy the new one.

But just in case you have issues with this approach, I will suggest to compare the features in the solution package and move it to another solution package.

Comments welcome...

Sunday, September 27, 2009

Name ActiveX Control prompt

Scenario:
Name ActiveX Control prompt issue

Reason:
SharePoint sites all include the Name ActiveX Control and, if it is not installed or approved by IE, IE displays a message until it is installed or approved as shown below

IE name issue

Solution:
KB31509 explains a few options

One of the things you can do on the client computer to prevent this message from appearing. Unfortunately, this is not an ideal scenario because users should not have to configure their desktops or browsers to view a content site. Also, many users may not have privileges to change the registry or the Internet Explorer trusted sites list.

KB article also describes a third option that involves changing the ECMAScript files installed by SharePoint Server. Unfortunately, this method is not ideal because it does not always work and it involves changing built-in files that can be overwritten by future hotfixes, service packs, or upgrades.

Another option is to create a custom ECMAScript file that overrides the ECMAScript function that contains a call to the Name ActiveX control, as demonstrated in Randy Drisgill blog. The ECMAScript file should include a function that overrides the built-in ProcessDefaultOnLoad() function and simply comments out the call to the ProcessImn()function. Add a reference to the new ECMAScript file in the <head> portion of the master page for the site.

Checkout the fix FIX Details

Sunday, September 20, 2009

Timer Job running on all servers

Scenario:
Lot of people said Custom Timer Jobs are unreliable. But we are using Custom Timer Job for our most of the projects without any issues except one common mistake I have seen developers making is that even though we just want it to run on one machine, it is firing multiple times.

i.e. Custom Timer Job is sending emails more than one time,

Reason:
Most of people start writing Custom Timer Job from AC blog , and it has issues. Infact 2 issues

(1st) Scope = Site which should be Web Application , otherwise users can activate and deactivate it many time in a web application which may not be a good idea.

(2nd) SPJobLockTypes is set to ContentDatabase which may not what you want.

Solution:
After checking the MSDN documentation I found significance of various enumeation values.

ContentDatabase : Locks the content database before processing.
Job : Locks the job to prevent it from running on more than one machine.
None : No locks

So setting the SPJobLockTypes = Job solved the issue. Now timer job runs on one box only. Keep in mind there is no way ( i know of ) to control on which server it is running.

Code:

public SharePointWarmupJob (SPWebApplication webApp)
: base(Globals.JobName, webApp, null, SPJobLockType.Job) {
this.Title = Globals.JobName;
Article:
Similar Entry I found after I posted this :-)

Matt Morse,Robin Meure,Peter Deleu

Friday, September 18, 2009

Sharepoint Designer file check in issue

Scenario:
I was working on a new site collection master page and was able to save the file without an issue but when I tried check in the file . I got the following error

Error : Can not perform this operation.The file is no longer checked out or has been deleted?

Solution:

I couldn't find out the exact reason but sometimes the SPD check in and out are not in sync with content DB.

So choices are :

Navigate the document library directly using Browser you are getting this problem and Check In using Browser ( SharePoint UI ) itself.

OR

Navigate the Content and Structures page and then go to the library you are getting this problem and Check In using Browser ( SharePoint UI ) itself.

Tuesday, July 21, 2009

Deployment stuck at deploying message

Scenario:
While trying to deploy a new solution , I was able to add the solution successfully but then deployment got stuck at deploying message.

Solution:
There is no perfect solution to it but there are couple of things you need to try.

Usually this problem is not with your solution but with any specific server in a multi-server farm. So before you open ticket with Microsoft, make sure you see the same behaviour for your solution on another machine.

Check few things:
1. Go to Central Administration
2. Navigate to Operations > "Global Configuration" > "Timer job status".
3. Look for Jobs name starting with either "Windows SharePoint Services Solution Deployment for "

There will be one entry for each of the front-end servers that the solution is being deployed to or retracted from. Usually one of the entries will say failed and the others will say succeeded so you can use this to help figure out which front-end is causing the problems.

Options:
1. If you are trying to deploy the solution globally, try retracting one by one from each web-application

2. If you are trying to deploying the solution using UI try command line STSADM or vise versa.

3. Try running following STSADM command.
STSADM -o execadmsvcjobs ( On all the servers )

4. If it is getting stuck only on a particular Web Application ( more commonly on Central Web Application ), then try deploying it first on another Web Application.

5. Restart the machine and try one more time.

6. Also if it is multi-server farm, try deploying from other machine.

Article:
STADM Commands

Friday, July 3, 2009

Datasheet view read-only

Scenario:
This was a new thing I discovered while helping my friend to fix a small problem he was facing while editing his list in Datasheet view. Problem was that he can edit all the other lists in Datasheet view mode except the one he had for which Datasheet says its in Read Only mode.



Solution:
I started comparing all the properties of the list with a regular list. Content Approval was the culprit. Actually Content Approval locks the list to Read Only in Datasheet view. The fact that items can be in a pending or rejected state can be too confusing for that view.

Thursday, July 2, 2009

Feature Stapling bug

Scenario:
This was a strange situation, we had a stapling feature which replaces the default page of Team Site , with a new page with more web part on it. Now the issues was , when we create a new site , all the web part shows up but only listview webparts are missing.

Also this behavior was random and if you activate the same feature manually after site is created there was no such issue.

Reason:
With my knowledge with sharepoint only thing I could think of was, list view automatically go missing if you don't have the list in site. So I think it was because of while site is getting created, list is still not created and so web parts got missing. Also that is inline with our second observation, when you activate the feature manually, there is delay and lists are created in the meanwhile and so we don't have list views missing.

Bug:
Clearly its a bug as the code should fire at the end of the Web creation life cycle, which is not the case.

Solution:

-- Either you can stick to manually activating the feature
-- Write a timer job which does this for you. ( May not be best of the best solution but this guarantees that it will only fire certain number of times. Also this timer can be extended to do much more things in future.

Code:

using System;
using Microsoft.SharePoint;
using Microsoft.SharePoint.Administration;

namespace SPCore
{
[CLSCompliant(false)]
public class FeatureStaplingBugFixTimerJob : SPJobDefinition
{
public FeatureStaplingBugFixTimerJob() : base() { }

[Persisted]
private readonly string _featureIdList; // list of feature need to activated

public FeatureStaplingBugFixTimerJob(SPWebApplication webApp, string jobName, string featureIDs)
: base(jobName, webApp, null, SPJobLockType.ContentDatabase)
{
Title = jobName;
_featureIdList = featureIDs; //this is one time updated by feature receiver
}

public override void Execute(Guid targetInstanceId)
{
var featureIds = _featureIdList.Split(";".ToCharArray());

foreach (SPSite siteColl in WebApplication.Sites)
{
foreach (SPWeb web in siteColl.AllWebs)
{
// Check if the property name already exists
if (web.Properties.ContainsKey("FeatureStaplingFixDone"))
{
if (web.Properties["FeatureStaplingFixDone"] != "True")
{
foreach (var featureId in featureIds)
{
if (featureId.Length > 0)
{
var featureGuid = new Guid(featureId);
var spFeature = web.Features[featureGuid];
if (null == spFeature)
{
web.Features.Add(featureGuid);
}
}
}
// Update property with new value
web.Properties["FeatureStaplingFixDone"] = "True";
}
}
else
{
// Add new property with name and value
web.Properties.Add("FeatureStaplingFixDone", "False");
}
web.Properties.Update();
web.Dispose();
}
siteColl.Dispose();
}
}
}
}
Enhancements:
-- This code only works for Feature need to be stapled at Web Level
-- More error handling in case specified features are missing

Download:
You can download the complete solution from here. To be able to build the solution on your machine, make sure to point the location of WSPBuilder to right location in INSTALL.bat file

Sunday, June 14, 2009

Web Application scoped Feature get auto activated

Scenario:
I had a timer job running with scope of Web Application and I faced an issue where I wanted to use it for only one Web Application , but when ever some one create a new Web Application , this feature was getting activated automatically.


I suspected of some auto activate property because I used AutoActivateInCentralAdmin before, and that's what it was. Feature definition support a property ActivateOnDefault , unfortunately its default value is TRUE. I will say big mistake from Microsoft.

As per my fellow friend Sahil this property has no effect on feature scoped at Web and Site level , it only works for Farm and Web Application level.

Solution:
Setting the ActivateOnDefault to FALSE solved the issue.

Code:

<?xml version="1.0" encoding="utf-8"?>  
<Feature Id="GUID" Title="Web App Timer" Scope="WebApplication" Version="1.0.0.0" Hidden="FALSE" DefaultResourceFile="core" ActivateOnDefault="False"> xmlns="http://schemas.microsoft.com/sharepoint/"
<ElementManifests>
<ElementManifest Location="elements.xml" />
</ElementManifests>
</Feature>
Follow me on Twitter

Tuesday, June 9, 2009

Custom Site Defintion and Feature stapling issue

Scenario:
We had 2 requirements
1. Develop a custom site definition
2. Develop a feature which is applied to only Out of Box defintions and not to the Custom Definition developed in step 1.

Here's how we had our feature stapling elements
Stapling:

<FeatureSiteTemplateAssociation Id="FEATURE_GUID" TemplateName="GLOBAL" />
<FeatureSiteTemplateAssociation Id="FEATURE_GUID" TemplateName="STS#1" />
Now the issue was it was applying the feature ( FEATURE_GUID ) to Custom Site Definition also.

Solution:
Site Definition declaration support an attribute AllowGlobalFeatureAssociations which can be set to FALSE to avoid binding with GLOBAL. STS site definition also uses the same technique.

Code:
<?xml version="1.0" encoding="utf-8"?>
<Templates>
<Template Name="CustomSiteDefinition" ID="10099">
<Configuration ID="1" Title="Custom Site Definition" Description="A site for teams to quickly organize, author, and share information. It provides a document library, and lists for managing announcements, calendar items, tasks, and discussions." Hidden="FALSE" ImageUrl="/_layouts/images/Client/Custom Site DefinitionLogo.jpg" DisplayCategory="Client" AllowGlobalFeatureAssociations="FALSE" />
</Template>
</Templates>
Article:
http://msdn.microsoft.com/en-us/library/ms476942.aspx
Follow on Twitter

Wednesday, June 3, 2009

Cleaning up the file names for uploading to sharepoint

Scenario:
Sharepoint imposes some restriction on the file and folder names . Also it doesn't allow some special characters in the file / folder name.

Solution:
Here's a quick fix to the file / folder name change using Regular expression.

Note : I am replacing the special characters with underscore and not with space because one space translate to %20 and occupies three character space in Url.

Code:

 using System.Text.RegularExpressions;

private string CleanUpSpecialCharacters(string fileName)
{
string fileTitle = fileName.Substring(0, fileName.LastIndexOf("."));
string fileExtenstion = fileName.Substring(fileName.LastIndexOf("."));

string pattern = @"[#%&*:<>?/{|}/\\.]";
Regex rgx = new Regex(pattern);

// Replace runs of white space in the input string with a
// underscore.
string newfileTitle = rgx.Replace(fileTitle, "_");

return string.Concat(newfileTitle, fileExtenstion);

}

private string Truncate(string fileName)
{
if (fileName.Length > 127)

return fileName.Substring(0, 127);
else
return fileName;
}

Friday, May 15, 2009

Event Handler exceptional behaviour

Scenario:
Programming events can cause exceptional behaviors, depending on the contexts in which you implement the event handlers. The following table describes event behaviors related to specific contexts that you might encounter when writing code.

Few known behaviour:

1. A request to delete an item through a list form does not have an associated content type ID, but this causes an ItemDeleting or ItemDeleted event to fire on all items, not just on items of a specific content type, even though the event was registered only for the content type.

2. The BeforeProperties property applies only to DocumentLibrary type lists.

3. List events do not fire on the UserInfo list.

4. Event handlers will not fire when bulk operation is occurring. For example, when a new list is created, the FieldAdding event will not fire.

5. Using element file to register an event handler attaches it to all the list of particular type. Most of the requirements need event handler to be attached to a particular list which can only be done through code.

Article:
MSDN

Event Handlers- Everything you need to know

Saturday, April 11, 2009

"Open with Windows Explorer" does not appear in ACTIONS

Scenario:
"Open with Windows Explorer" does not appear in ACTIONS

Solution:
Open with Windows Explorer feature is driven using an ActiveX just like Multiple Document Upload and Edit in Datasheet feature...

--> Client needs to have Microsoft Office installed in order to be able to upload multiple files.

Try out these option

1. Check if Multiple Document Upload and Edit in Datasheet features are working
2. Check if this feature ( Explorer ) is available from other machines
3. If you have done any updates on your machine or installed something .. restart the machine once.

4. Make sure you are using Internet Explorer 6.0 or higher

I am 98% sure that this is machine specific issue. If you see this feature working from other machine , you can do a compare-match of your Internet Explorer settings.

Monday, March 30, 2009

Datasheet view missing

Scenario:
Datasheet view / Multiple Upload options missing

Solution:
This can happen more than one reason. Lets see.

Is it missing for one client only? This means there is something issue with the client machine.
http://support.microsoft.com/default.aspx?scid=kb;EN-US;949670

Its missing for everyone ? This is server side issue.
http://kirkeberg.spaces.live.com/Blog/cns!807B63CB57585EB4!265.entry?wa=wsignin1.0&sa=749340664

Wednesday, March 11, 2009

Deployment stuck at retracting message

Scenario:
I added and deployed a solution to my farm and when I tried retracting it, its stuck and continue to show Retracting message.

Solution:
There is no perfect solution to it but there are couple of things you need to try.

Usually this problem is not with your solution but with any specific server in a multi-server farm. So before you open ticket with Microsoft, make sure you see the same behaviour for your solution on another machine.

Check few things:
1. Go to Central Administration
2. Navigate to Operations > "Global Configuration" > "Timer job status".
3. Look for Jobs name starting with either "Windows SharePoint Services Solution Retraction for "

There will be one entry for each of the front-end servers that the solution is being deployed to or retracted from. Usually one of the entries will say failed and the others will say succeeded so you can use this to help figure out which front-end is causing the problems.

Options:
1. If you are trying to retract the solution Globally , try retracting one by one from each web-application

2. If you are trying to deploying the solution using UI try command line STSADM or vise versa.

3. Try running following STSADM command.
STSADM -o execadmsvcjobs ( On all the servers )

4. If it is getting stuck only on a particular Web Application ( more commonly on Central Web Application ), then try Deploying it first on another Web Application and then retract from Web Application which had issue.

5. Restart the machine and try one more time.

6. Also if it is multi-server farm, try deploying from other machine.

Article:
STADM Commands