Category: Sharepoint 2010

Removing Checkbox from SharePoint 2010 List

If you want to remove checkbox from SharePoint 2010 List, Document library or List View webpart on a page and are confused How to do it, first of all welcome to the boat. Secondly, It’s really simple, It’s so simple that you will feel stupid in a couple of minutes to have searched for it onlineJ.

Open the “View” You want to modify. (Click on List/library option on top ribbon, Select View you want to modify (“PageView”), click on “Modify View”.

Scroll down to “Tabular View”

Uncheck “Allow individual item checkboxes”

You are done.

If you want to update it on a List view webpart.

Go to “Edit Webpart”, Select the view you just updated in previous section.

Clearing Sharepoint Designer Cache

Many times sharepoint designer gets stuck/ Considers checked out files as checked in or vice versa.

In most common scenario you’ll see a message like “Cannot perform this operation. The file is no longer checked out or has been deleted.” while checking in a file.

The solution is to clear all the cache that SharePoint designer has stored on your machine.

For clearing that you can press Win + R and navigate to these two folders and delete all available files.

  • %APPDATA%MicrosoftWeb Server ExtensionsCache
  • %USERPROFILE%AppDataLocalMicrosoftWebsiteCache

Step by Step guide to Styling Sharepoint Lists/Libraries Using Sharepoint Designer

Many Times there is requirement for Styling SharePoint items like Custom Lists, Document library, Pages etc… so as to Emphasize certain Data over other so that it is noticeable or to present it to end-user in such a way that it doesn’t appear to be a SharePoint listFor this requirement first thing is to identify what will be visible to end user. Is it a list or list webpart in a Site Page because in this approach when you’ll edit the list it will create XSLT on that particular page and won’t be visible elsewhere.

Here we are creating a Custom List ( Sample List).

And Add Few Columns to it. (say Employee Name, Comments, Performance etc…)

Employee name is a Single Line of text, Comments is a Multiple Line of text and Status is a Choice with 3 Values Met Expectations, Under Performed and Exceeded Expectations.

Once we’ve got this in place we will Remove title From Required list

and Modify this view to get the required fields in the view.

Now go to Site Actions and Edit Page in SharePoint Designer (and Then wait for it to load the site which will take long long time). Now on Left Pane select “List and Libraries” and from there Select Your List and Click DispForm.aspx in Main Area.

Performing Action in SharePoint Designer Workflow after Specific Time

For sending out a notification or Setting a field Value in SharePoint after a specific time or on a particular date (that you fetch from the List) easiest way to go around is create a SharePoint Designer workflows.

Here we’ll be setting Due Date Value Back to Blank.

Connect to Specific site in SharePoint Designer.

Click on Workflows in Left Nav.

Select the List you want to attach workflow to

Go To Initiate Form Parameters in Top Ribbon.

Add a New Field:

Set Value to ‘None’

Go to Find Interval Between Dates in Utility Section

Set it as “Find Days (or as appropriate) between Today and Current Item: “(by clicking fx J)

Go to Actions and Do Calculations (if You want to add more value to it )

Add Variable Created above with the value you need.

Then Pause for specific duration :

Go to Action and do Send Email or Set Field (action you want to perform)

Set your field to Blank Date field Created earlier

Save the Workflow.

Click on Workflow name in Navigation.

Select Start workflow automatically when Item is created

Save it and Publish it.

Sharepoint XSLT Transform Issue

While creating custom form of a list if you have encountered given exception.

Error while executing web part: System.StackOverflowException: Operation caused a stack overflow.
at Microsoft.Xslt.NativeMethod.CheckForSufficientStack()
at (XmlQueryRuntime , XPathNavigator , Double , String )
at (XmlQueryRuntime , IList`1 )
at (XmlQueryRuntime , XPathNavigator )
at Root(XmlQueryRuntime )
at System.Xml.Xsl.XmlILCommand.Execute(Object defaultDocument, XmlResolver dataSources, XsltArgumentList argumentList, XmlWriter writer, Boolean closeWriter)
at System.Xml.Xsl.XmlILCommand.Execute(IXPathNavigable contextDocument, XmlResolver dataSources, XsltArgumentList argumentList, XmlWriter results)
at System.Xml.Xsl.XslCompiledTransform.Transform(IXPathNavigable input, XsltArgumentList arguments, XmlWriter results)
at Microsoft.SharePoint.WebPartPages.DataFormWebPart.ExecuteTransform(XslCompiledTransform xslCompiledTransform, XsltArgumentList xmlArguments, Boolean bDeferExecuteTransform)
at Microsoft.SharePoint.WebPartPages.DataFormWebPart.PrepareAndPerformTransform(Boolean bDeferExecuteTransform)

in which some time Edit form opens and some time it doesn’t then most probably the issue with your form is too heavy for SharePoint to handle i.e contains a whole lot of fields (here whole lot of can be 50 and above)¬†ūüôā and it is taking more than one second to transform the XSLT.

The best chance you have to avoide this exception is to clean up XSL in the form or remove the controls that take more time to render (like BDC).

To clean up the XSL
1. You can remove the description part of SharePoint controls from your form. It will reduce whole lot of XSLT that you are not using and make your form render faster.
                          The description tag looks something like :

2. Remove the unnecessary datafields sharepoint is fetching and that are not used in the form (be very careful here )

NOTE: If you are getting same exception and form never renders then the reason could also be that you have messed up XSLT at someplace and its stuck. Eg. You have copied and pasted a control some where on page and both controls have same ID like id=”ff9{$Pos}”.

In this case try to recall what changes you made in the page and act accordingly.

Sharepoint 2010 Site Action Menu not working in IE 8/ IE 9 : Permanemt Fix

In March I wrote a post for enabling Site Menu when it is not working in IE 8/9.
That was not a permanent fix and I forgot to update that post with the Permanent Fix.1. Understanding the Issue.The issue we were facing was because the document mode in which IE was rendering the Page was different from the browser mode.2. Fix

Force IE to render in the desired mode. (Same thing we did in previous post, but this time using a meta tag)

To fix this issue :
1.  Edit Master page of your sharepoint site using Sharepoint Designer
2. Find ‘HEAD’ tag ()
3. Add given meta tag just below head tag

This will force IE to open in IE 9 mode. If you have IE 8 as your default document Type then change it accordingly.

For more information on http-equiv attribute you can go through give Hyperlink.

Sharepoint 2010 Site Action Menu not working in IE 8/ IE 9

Update: Premanent Fix for the issue is here.

If you are trying to click on any option in Site Action Menu like “View All Site Contents”, “Create Site”, “Site Settings” etc… and you are not getting any response then the mode in which your browser is running is not correct.The mode is set in Sharepoint master page and how to set it to generic, I’ve no Idea ūüôā but I’ll be looking for it and post it back.To work around this issue you can press F12 in your browser (when you are on a perticular sharepoint page you are working with) or go to Tools and then F12 developers tools.

Play around with last two options i.e. Browser Mode and Document Mode.

If rendering is set in Master Page for IE 8 and you are in IE 9 compatibility mode (Browser mode), it will not work.

If it is set in master page for IE 9 and you are in IE 8 Standards in Document mode, it will not work.

So play with browser mode when document mode is set to IE 8 standards,
then play with browser mode when document mode is set to IE 9 standards.

In some combination it will work :).

Update : Permanent Fix for the issue is here.

Sharepoint Exception: Trying to use an SPWeb object that has been closed or disposed and is no longer valid.

When I created sharepoint webpart and Used

using (SPSite site = new SPSite("http://Server:port/sites/Site/"))
using (SPWeb web = site.OpenWeb())
//Some Code Here.

It worked fine but before deploying I changed new SPSite(“http://Server:port/sites/Site/”) to SPContext.Current.Site and it started throwing the above exception on the Error Page but while debugging there was no Exception.

Weird issue and I don’t have any explaination for it but what helpd me solving the issue was the fact when we are passing Url to the SPSite it works fine.

So on the same lines I used SPContext.Current.Web.Url to fetch the Url of current siteand It worked like a charm.

So instead of above if we use

using (SPSite site = new SPSite(SPContext.Current.Web.Url))
using (SPWeb web = site.OpenWeb())
//Some Code Here.

it works. ūüôā