How to hide a SharePoint list column from a list form (New, Edit, and Display)

Managing the Content Type of a SharePoint List will provide you with the option to Show or Hide a column (aka Field) from the “New.aspx”, “Edit.aspx”, and “Display.aspx” list forms. If you didn’t want to show a column on any of the forms, you could select the column and ‘hide’ it from all forms.

Unfortunately, if you manage the content type of a list form, you are not able to choose which of these forms you can hide a column from. By default, hiding a column will be hidden on all forms.

In this post, I will show you how you can view all columns in your list and then choose which form to hide the column from.

(more…)

How to add a new item to a SharePoint list using Javascript and the Lists.asmx web service

I had an idea at the beginning of the year. I am the Site Collection Administrator and am only responsible for administering and developing solutions for my SharePoint site collection in my office (about 2000 employees). I do not have access to the SharePoint servers to install WSP’s, use STSADM, or even PowerShell.

I am in charge of all development for my Site Collection but getting a custom SharePoint web part or WSP solution into production takes weeks….and sometimes months. So, i began working with the Content Editor Web Parts (CEWP’s) to see if I can use the SharePoint Web Services and Javascript as a “Poor man’s” web part. My “Poor man’s” web parts are only CEWP’s which don’t have to go thru a special code review and approval process before being moved into the production SharePoint farm.

If you are under these same kind of restrictions, maybe you’d like to consider this approach as well. However, this isn’t the best approach in that things can ‘break’ easily if someone modifies your code in the CEWP’s.
 
(more…)

How to use the Content Editor Web Part to build a dynamic link based on your current URL

Believe it or not, this is a very useful piece of code. I use it often in my content editor web parts to get the URL of the site I’m currently on.

To be more specific, I use this code to get the URL of the site, then modify it to dynamically create a URL that points to the LISTS.ASMX web service. Why is this useful? Consider the following:

  1. I have a custom list at the root site collection that is readable by everyone.
  2. The list contains a link to a custom web part page that is located on each site (subsite) in my site collection. The web part page is just a blank page that has a few CEWP’s (content editor web parts) in different zones.
  3. One of the CEWP’s only function is to get the URL of the site, then does a javascript ‘split’ to get each element of the URL. This is necessary to build a custom URL that points to the ‘LISTS.ASMX’ web service for the site I’m on.
  4. Once I have the new URL (that has been modified to point to the ‘lists.asmx’ web service), I can then query my sites schema (including list schema) for the site.

I find this to be VERY useful in that I can get a listing of all lists and libraries for a site and view the XML schema behind them, all bundled up in a single report. Instead of going thru each site and each site’s lists one at a time, I can view the XML schema from a single ‘web part page’.

So, to get started, I’m going to show you how to get the URL from a site. Let’s begin by assuming you are on a SharePoint site at this URL: (more…)

How to use a Content Editor Web Part to get the value of a query string

I often use query strings in SharePoint web parts, links, lookup columns, etc., and have found this bit of code to be very useful when having to display content on my page based on the value of a query string parameter. Here’s an example of how to get the value of a query string parameter by using JavaScript:

(more…)