Showing posts with label Bug. Show all posts
Showing posts with label Bug. 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

Sharepoint workflow changes missing

Scenario:
Recently I developed a Sharepoint designer workflow and it worked fine, now after few days i made small changes to it but it didn't apply the changes in the site collection.

1. Opening WF in SharePoint Designer shows all the new changes
2. Workflow was published without any errors
3. Tried creating new items and ran WF but still see the missing changes

Solution:
After searching about this issue, I found some valuable information

http://blogs.msdn.com/sharepointdesigner/archive/2007/03/27/tip-clearing-the-spd-workflow-assembly-cache.aspx

If you are building a workflow activity on WSS/SharePoint Foundation for SPD you may have to update your activity DLL regularly (say to fix bugs or alter behaviors). Sometimes when you do this, SPD won't recognize your changes to the activity and instead appear to be using the 'old' DLL. Depending on what you've changed in the activity on the server, SPD may not allow you to use this activity at all. This is due to a mismatch between the server's activity and the SPD client's cached activity. To fix this problem its a good idea to clear your SPD activity cache whenever you update your activities DLL on the server.

To clear the SPD activity cache:

1. Close SPD.

2. Open "My Computer".

3. Go to %System Drive%\Documents and Settings\%user%\Local Settings\Application Data\Microsoft\WebSiteCache (If you are running Vista, that path is different - look for %System Drive%\Users\%user%\AppData\Local\Microsoft\WebSiteCache).

4. Go to a directory that looks similar to the name of the website you were connecting to. (Alternatively, you can just delete all these directories and everything should work when you boot SPD).

5. Delete the assembly with the name similar to the one you are changing.

6. Boot SPD.

7. You can now work with your updated activity. Once done publish to see the new changes.

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

Monday, February 21, 2011

SharePoint : Limitations

Scenario:
After working on SharePoint for some time now. I thought of documenting few of the limitations I came to know.

Design:
1. Error : Most of the error messages are mis-leading. I agree this has improved in SP2010 as we have correlation token's to trace the error much faster.

2. Packaging : WSP are great but when it comes to deploying something in Inetpub folder, its limited.

File System:
1. Project Structure : SharePoint 12/14 hive feature folder doesn't support sub-folders. So developers need to add some prefix to identify all the features from one project in 2007. Same is done automatically by VS2010 in case of SP2010 projects.

2.Field Control and User Control based templates : Even though it is possible to have a sub-folder in CONTROLTEMPLATE to logically group multiple user controls which are custom developed under a sub-folder. This is not possible for the User Controls which are used by Field Controls. SharePoint will not be able to read these Field Control / Editor templates. Applicable to both in SP2007/2010.

3. XML files merging : While SharePoint does a great job of merging various site definition XML file ( any file with prefix onet** ) , this is not possible with other XML files like AlertTemplates.xml / DocIcon.xml.

UI Related limitation:
1. Views : View are great but again with a limitations. You can create many many views but the View Drop will be able to list out only 50 :)

2. Pages Library : Doesn't support sub-folders in SP2007. In SP2010 it does, surely a relief.

3. List in general : Doesn't support sub-folders in SP2007 and SP2010. Document libraries does.

4. Incoming Email : Great feature, you send an email with an attachment and if you have setting to retain the original email also for the document library. You will see 2 new documents created. Once some few emails with attachment arrives in the document library there is not way to identify which attachment belongs to which email. LOL :)

5. Calendar List : Recurring events are great but try editing one single instance of it and that it. Weird things will start happening. Manage permission menu is gone from UI altogether for this item. Actually its a bug.

Coding :
1. SPQuery class : There is no easy way to figure out the exact number of records returned by a particular query. In case you need to display that 1-10 of x results type display, no luck.


There is not the exhaustive list , but I will keep updating as I see more.

Wednesday, May 12, 2010

SharePoint 2010 - What I hate

SharePoint 2010 is BLAH BLAH BLAH , i know that but there are few things I really didn't like or hated.

Hardware requirements for SP2010 Development:
I am sure you know it that you need 64bit machines + 6-8GB RAM to be able to develop for sharepoint 2010 but thats not all. What ever way you tune it you will see Virtual machines slowing down often / hung / crashes and much more..

Top Nav and Quick launch Navigation links:
You can click the links to navigate to the page/document but you cant right click the navigation links in Top Nav and Quick Launch and say open in another Tab. As during the demo's we need to have multiple pages open to save time, you will feel the pain.

Core Search Web Part configuration change:
Have you tried changing the Metadata properties or XSLT for the Core Search web part , once you save it, Core Search web part will display a message "Refresh the web part... ", Its such a pain in case you want to play around different look and feel with extra metadata columns and xslt. One workaround I used was I designed my XSLT in 2007 and then used it in SP2010.

Content Query Web Part configuration:
In case you want to filter out items from the site collection based on its Content Type, Content Type Column is missing from filter list. You do have an option to filter items based on SINGLE content type.

i.e You can filter all the items of content type 'Business Page' but in case you want to see all the items which have content type as 'Business Page' or 'Finance Page' , you can't.

Alert Templates customizations:
Alert templates are stored in AlertTemplate.xml and if you want to have custom templates there is no other option then modifying OOTB file which is not recommended. In SP2010 , still the option is missing to add a new AlertTemplate_XYZ.xml file and let SharePoint merge the two files automatically.

Alerts and Delivery Options:
Try setting an alert for a task list , delivery options are Email OR SMS , there is no way to specify that I want both ???

Processing dialog missing while create Web Application:
Confusing .. as you don't know whats going on behind the scene.
I will add more with time in the meanwhile leave your comments from your experience.

Learn more languages:
As a MOSS developer , you were suppose to have experience of ASP.Net 2.0, HTML, Javascript, XSLT, CSS , CAML , WebServices , Infopath

As a SP2010 developer , you were suppose to have experience of ASP.Net 2.0, Framework 3.5 , HTML, Java-script, ECMA Script , XSLT, XHTML, CSS , CAML , LINQ , Silverlight, WCF ,InfoPath , PPS Designer , Power-shell and much more...

Client Object Model:
You are reading it right, even though this is a great feature added to SP2010 but also a pain to learn 3 different kind of Client OM , one for .Net Applications, Silver light has it own and JavaScript client has it own.

Also if not used very well , client object model can easily be used to delete items from site collections.

Sandbox Solutions:
Again I know this is a great ++ thing for hosting environments but as Microsoft has given options to control resource usage for all the sandbox solutions as a whole. One bad sandbox solution can eat up all the resources and block other solutions.

SharePoint Service Application:
:) - I know its a great improvement in terms of scalability but how many more databases and IIS Web Applications to manage ??
dbs

Visual Studio 2010 Tools for SharePoint
GREAT , far much better experience than 2007 BUT still few missing pieces.

You need to pre-plan a lot about what's the assembly name you need, feature naming etc in advance to be able to use it in real sense.

a) Any updation to output assembly name / feature name / namespaces etc will not be synced by Package Designer

b) Edit XML options is great but there is an issue. Once you start doing Edit XML, you are out of sync for any new changes. Now if you add any new feature / remove a feature , your manifest will not be synced with the changes any more. I am sure all of us is going to experience the ERA of 2006 where people use to hand create manifest files. lolz..

c) In case you want to deploy a Infopath as content type, you can't design a feature for it using VS 2010 sharepoint project as it doesn't allow you to include files in root folder of Feature. Elements Manifest/Files will always be in sub-folders, and that makes it difficult for deploying infopath as content type.

InfoPath 2010
Metadata control is not available
No easy way to publish browser enabled forms packaging as Content Type feature

Content Type Hub
Syncs content type across site collections but if you have an external template file, it will not be synced.

Also in case of infopath based content types, if template also got synced it will become non-browser enabled and will open in Infopath only and not in browser.

Silverlight new UI for creating new assets
Looks awesome until you get an error. Bad part is that it will give you error with correlation id and you cant select the HTML because its silverlight :)

Import WSP option in VS 2010
Try this , you will be amazed to see that Microsoft is dumping complete SharePoint content types in your solution. Too good but too much to clean.

Breadcrumb:
This is another crappy piece SP2010 has now. It works well mostly for sites but in case you go to Central Administration and navigate to series of screens. Check the breadcrumb now and only thing it shows is link to home page. You will need to go through all the those click again to reach the screen again.

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, November 17, 2009

RootFolder Query string bug

Scenario:
Funny, still finding weird bugs in SP2007.

I had a navigation web part and had a link to add a new item inside a sub folder within a list.

When I click on link I can add new items but when I hit OK to save it, I gets Access Denied.

But if same account directly navigate to the folder with in that list, he can add a new item without any issue. hmmm...

Solution:
I copied both the Urls ( New item page link ) and started comparing.

Sample:

Working : http://localhost/Lists/Custom/NewForm.aspx?RootFolder=/ABC

Not working : http://localhost/Lists/Custom/NewForm.aspx?RootFolder=/abc
Lesson learnt:
Urls are not case sensitive but Query parameters are ( specially if they are not handled for ignoring case )

Changing the abc to ABC solved the issue.

Monday, October 12, 2009

Copy an existing item to another list

Scenario:
I wanted to copy an existing item to another list. I found a solution here but it didn't work for me fully.
Item I was trying to copy are inside a folder with the list.

Solution:
Solution i found was copying items at the root level. But as my items were inside the folder , I wanted to copy over to new list in same folder. Here's modified code.

Code:

public static SPListItem CopyItem(SPListItem sourceItem, string destinationListName)
{
//copy sourceItem to destinationList
SPList destinationList = sourceItem.Web.Lists[destinationListName];
string folderName = "/" + itemToCopy.Url.Remove(itemToCopy.Url.LastIndexOf('/'));

SPListItem targetItem = destinationList.Items.Add(folderName, SPFileSystemObjectType.File);

foreach (SPField f in sourceItem.Fields)
{
if (!f.ReadOnlyField && f.InternalName != "Attachments")
{
targetItem[f.InternalName] = sourceItem[f.InternalName];
}
}

//copy attachments
foreach (string fileName in sourceItem.Attachments)
{
SPFile file = sourceItem.ParentList.ParentWeb.GetFile(sourceItem.Attachments.UrlPrefix + fileName);
byte[] imageData = file.OpenBinary();
targetItem.Attachments.Add(fileName, imageData);
}

targetItem.Update();
return targetItem;
}
Article:
Copying over a SharePoint list from source site to destination site
Copy or move Sharepoint list items using SPExport and SPImport
SPListItem.CopyTo does not copy

Saturday, July 4, 2009

Listview RSS Bug

Scenario:
I think I am discovering lot of bug these day.. :-)This is simple but I think very important.
I had a document library which has more than one views.One of the filtered view shows document which are recently added by a certain department.

Bug : RSS Feed for the view is not filtered. Also this is easily be noticed from the Url itself which is something like this
http://localhost/_layouts/listfeed.aspx?List=ListGUID

Solution:
Right Url need to be
http://localhost/_layouts/listfeed.aspx?List=ListGUID;View=ViewGUID
I tested the above url format by adding the View GUID and got the filtered items also. That means only link is broken or I will say not completed.

Now there are many ways it can be solved.(I have not implemented any one of them so far )

-- New Action Menu which has corrected ViewGUID and hide the existing one
-- You can fix the exiting menu using JQuery
-- New web part to display RSS icon with correct IDs.

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

Monday, January 26, 2009

SharePoint Search bug

Scenario:
I was trying to do a small demo for the search scope and create a new scope to only restrict results to pdf files.

So I enabled the File Extension property for Use in Scopes. Created a new Scope and added the rule to include only File Extension = pdf. When I tried searching for a file I uploaded 2 days back , I couldn't find it.

Bug :

Try 1:
a) Uploaded a file 'ITTP_SharePoint_Contents.pdf' ( underscores )
b) Search with Keyword : Sharepoint
c) File is not in the result set.

Try 2:
a) Uploaded a file 'ITTP SharePoint Contents.pdf' ( no underscores but spaces this time )
b) Search with Keyword : Sharepoint
c) File appears right on the top of result set.

Try 3:
a) Uploaded a file 'ITTPSharePointContents.pdf' ( no spaces this time )
b) Search with Keyword : Sharepoint
c) File is not in the result set.

I tried all these options in Google and I got the file in all three cases, which is what I was expecting.

Solution:
I will certainly call it a Bug, and will recommend the clients to avoid using Underscores and to keep spaces in the file name if you want to search by the file name. I know each space translate back to %20, which means 3 character space, but thats the way it is.

Update:
I got a chance to talk to my collegue Sahil over the same and he mentioned that this has been done intentionally in SharePoint Search to increase performance. Also as SharePoint search basically uses SQL Full Text, wildcard search will be limited as we have seen above.

You can certainly try to do some modification to search webpart or can write a custom search webpart, and modifying the query keyword
i.e SharePoint --->> %SharePoint% to force wild card search.

That way you will get results in all three scenerios's but performance might become an issue then.

:-(

Thursday, August 28, 2008

This item cannot be deleted because it is still referenced by other pages

Scenario:
You are trying to delete a master page or a page layout.

Error: "This item cannot be deleted because it is still referenced by other pages"

You verified that there was no page using that master page or page layout.

Reason:
Bug in MOSS

Resolution

1. Create a new sub-folder in the master page gallery
2. Move the page layout to the new folder (I did this by using SharePoint Designer)
3. In the MOSS interface, delete the complete folder by using the dropdown menu.

References:
KB article: http://support.microsoft.com/?kbid=926812