Tuesday, July 14, 2009

How to delete Bad lists from SharePoint

Hi,

I was doing development in my last project (WSS3.0). I was doing some R&D on a SharePoint list. That list goes corrupted and not even i was able to open that.

So i decide to delete from my sharepoint site. What is this!!! how can i delete this list because delete option is coming under the list settings. What i have to do now???

Then i got a brilliant idea in my mind why not i use STSADM for this.

Here is that superb command which can help everybody who is hanged up with this problem:-

stsadm -o forcedeletelist -url http://localhost/Lists/Badlist

Enjoy!!!

Kuldeep Kadyan

How to get Display Name of List Column in SharePoint

Hi,

Few days back i was struggling a lot about to get the Display Name of list columns because client was not ready to move a single bit on his decision to show only column's display name not the internal name.

I spent near about the whole day to find out the solution of this problem. Thank god finally i got the lines of code that helped me.

I do not want to anybody else will struggle for the same.

I am putting code here:-

Get Display name of list columns

foreach(DataColumn column in table.Columns)
{

column.ColumnName = list.Fields.GetFieldByInternalName(column.ColumnName).Title;

}

It can save your time for sure.

Kuldeep Kadyan.

How to get Sum of any column in DataView Web Part in SharePoint

Hi,
Another basic requirement of client if you are using the DVWP in your project. Show the total of any column. I spent 3-4 hours to get it down but finally i found that.

Find sum of any column in DVWP

{xsl:value-of select="sum(/dsQueryResponse/Rows/Row/@fld_EmployeeSalary)" /}

Replace curly brackets with angular brackets
You had done that here.

Enjoy!!!
Kuldeep Kadyan

How to get current logged in user's group name in SharePoint

Hi,
Based on my last project requirement i need the current logged in user's group name so that we can hide and show something on page load.

There were a lot of ways but i like the smallest way to do this.
Here it is:-

Get Current User Group (C# example)

foreach(SPGroup group in SPContext.Current.Web.CurrentUser.Groups)
{ string groupName = group.Name;
Response.Write(groupName);
}

Seems cool???

Kuldeep Kadyan

How to get TOTAL number of records under a group in Data View Web Part in SharePoint

Hi,
Few days back i was struggling with different aspects of Dataview webpart in sharepoint designer.
I badly need to show the total of records under each group as we were having different level of grouping in our DVWP.

Finally i got solution for that. I just want to share with you.

Here it is:-

Get Total of Rows under a group

{xsl:value-of select="count($nodeset)" /}

*To get total number of records in DVWP
{xsl:value-of select="count(/dsQueryResponse/Rows/Row)" /}

Replace curly brackets with angular brackets.
You will get the result what exactly you want.

Have a fun!!!

How to call a Javascript function to use XSLNode value in SharePoint Designer

Hi,
To use any node(item) value in custom SharePoint page for SharePoint list using javascript you can use like this.

GetPic(var status)
{Put your code here}

Call JavaScript Function
{script type="text/javascript"}
document.write(GetPic("{xsl:value-of select="@Status" /}" ) )
{/script}

Replace curly brackets with respective angular brackets.
You must write &quot at the place of quote otherwise there will be xslt error.

Hope that will help you.