Prevent over-indenting in SharePoint Designer

Filed Under (SharePoint, SharePoint Designer) by Boris Gomiunik on 05-03-2010

After I installed SP2 for Office 2007, an annoying issue occurred. All the code started over indenting – meaning that a sub-node was indented 4 tabs into instead of 4 spaces or 1 tab.

image

There is a setting in SPD to fix that. In Tools menu select Page editor options

image

And under Code Formatting decrease the value in Indent property or change to spaces.

image

Cannot get the list schema column property from the SharePoint list

Filed Under (SharePoint) by Boris Gomiunik on 03-03-2010

If you’re trying to export data from a SharePoint list to Excel you might get this error message. Possible causes / solutions:

1. Change all Date and Time columns to single line of text and then back to Date and Time. Don’t worry, the data in these columns will be preserved.

2. There is a Microsoft Post-SP1 hotfix available here. It doesn’t fix lists that already have this issue though

3. If you export data to from SharePoint 3.0 / 2007 to Excel 2003 you might be getting this kind of error

4. If you’re exporting multiple choices field to Excel 2003

5. If you rename a Date and Time column this error may occur. Create an additional column and copy-paste values in a DataSheet view from one column to the new one

6. Changing the default date for Date and Time column from "Today" to "None" and then back may resolve the issue

All of the above solutions still didn’t work for me. What did the trick was following:

7. Lookup column points to a calculated field. Changed the lookup column to not point to calculated field but to a Single Line of Text field and the problem went away.

Technorati Tags: ,

Insert a WebPart in SharePoint 2010 list form

Filed Under (SharePoint 2010) by Boris Gomiunik on 02-03-2010

If you need to add custom JavaScript to SharePoint 2010 list form just like in 2007 (for example the SharePoint Cascaded Lookup), you’d need to insert the Content Editor WebPart to the same form. There are couple of ways to do it. Here’s one:

1. In a SharePoint List View select the "List" tab in "List Tools" tab group:

image

2. Select "Form Web Parts" and select "Default New Form" or "Default Edit Form".

image

From here on you can add webparts and edit their properties like in any other page.

image

Online JavaScripts library launched

Filed Under (JavaScript, SharePoint) by Boris Gomiunik on 01-03-2010

When dealing with quite some scripts for this blog or at work, I always come across couple of supporting JavaScripts that I constantly reuse. That’s why I’ve created an extra page to publish those scripts and have them available at one place. And if you find some use for them, so much the better.

Those scripts are just thrown there for now – all undocumented and some even borrowed from other pages. The library will be expanding as I create / come across new scripts.

Hope you find them useful.

Click here to see the JavaScript Library

Technorati Tags: ,

Create folder when saving directly to SharePoint Document Library

Filed Under (SharePoint) by Boris Gomiunik on 22-02-2010

When creating a document in Office, you can store it directly to SharePoint by typing your SharePoint site’s URL in the "File Name" field. This will open the SharePoint site where you can select the document library you wish to store your document to. But if you need to create a folder in the target document library, this isn’t possible, because the "New folder" icon is grayed out.

image

If you switch view by using the rightmost icon,

image

The "New folder" button is magically enabled. :)

image

Now you can create, select and save in the new folder directly from an Office application.

Technorati Tags: ,

Power of CEWP series: Selecting objects in SharePoint DOM

Filed Under (JavaScript, SharePoint) by Boris Gomiunik on 21-02-2010

The second article from the series Power of Content Editor WebPart is published. It’s titled Getting to the object. It’s a sequel from the first article and in this part we learn how to use some of JavaScript’s native functions to select the element we wish to modify in SharePoint. We also make a simple demo of enabling HTML tags in a list description. You’re welcome to read it and please leave all your question and comments in this post’s comments.

Just as a side note, I began preparing this series as a presentation for SPSEMEA. You can find recordings from this fantastic online event here.

Technorati Tags: ,

Create Cascaded (related) Lookup Dropdown fields easy with no server deployment

Filed Under (JavaScript, SharePoint, SharePoint Lookup field) by Boris Gomiunik on 17-02-2010

I’ve added a new section on my page dedicated to JavaScript solutions that I’ve published. The latest one is intended for creating a Cascaded Lookup Dropdown fields in a SharePoint New or Edit Form.

What is a Cascaded dropdown? It’s a combination of two dropdown lists. By selecting an option in the first dropdown (parent) you filter the options in a second dropdown (child).

Using this simple-to-deploy and configure solution you can create multiple cascaded relations in the same form. It works in MOSS 2007 / WSS 3.0 and in MOS 2010 / WSF 4.0

You can visit the project page here or download the JavaScript solution from CodePlex.

The quick way to get to know the internal name of the SharePoint Column

Filed Under (JavaScript, SharePoint) by Boris Gomiunik on 16-02-2010

If you need to know the internal name of a SharePoint column (which can be pretty different from actual if you’re using spaces and latin characters, you can discover this very simple:

  1. Go to list’s settings and edit the properties of the field (on a sample below we’ll get to know the internal name of a "Business phone" column in a standard Contacts list:
    image
  2. In the URL of the "Change Column" page, look for "Field=…" at the end:
    image  
  3. In the example above, the internal name is WorkPhone. But if your column name contains strange characters, like e.g. Hello%5FWorld%5Fx0020%5FColumn (which we would get if we created a "Hellp_World Column" column, type the following in the URL bar of your Web Browser:
    javascript:unescape(‘[your-field-name]‘)
    and press enter. You’ll get the internal name of the field:
    image

Why is internal column name good for? XSLT views code in SharePoint Designer, Querying SharePoint Web Services, custom scripts, when programming backend against a SharePoint list or list item,…

Power of Content Editor WebPart article series started

Filed Under (JavaScript, SharePoint) by Boris Gomiunik on 08-02-2010

Feedback from SharePoint Saturday EMEA online still brings good results. Not only did it make me cleanup quite some of my JavaScripts to prepare for presentation, but it also inspired me to start the "The Power of Content Editor WebPart" series of articles. It’s going to be an at-least 10-part series. Covering from basics to a bit more in-depth on how to use JavaScript to

  1. Change the looks of SharePoint pages
  2. Add features and functionalities to SharePoint Pages and list forms
  3. Read from and write data to SharePoint Lists using SharePoint’s Web Services.
  4. Some other stuff we’ll come along on the way

If you wish to know what all we’ll be getting to know there are already all examples explained in my previous post.

Starting off easy we learn how to insert the CEWP also in pages where the "Edit Page" command in "Site Actions" is not available.

You can find the series article here: The Power of Content Editor WebPart.

As soon as new content is added, I’ll be letting you know.

SPSEMEA Demo site and showcase

Filed Under (JavaScript, SharePoint, jquery) by Boris Gomiunik on 03-02-2010

I’ve prepared a SPSEMEA Demo site that you can simply upload to your (http://[siteUrl]/_catalogs/wt) Site template gallery.

You can download the .stp from CodePlex

After you’ve uploaded the file to the Site template gallery you can create a subsite (English language) and from Custom you can select the uploaded template.

Below’s a brief overview where you can find tricks. How it’s done – check for Content Editor WebParts in that page (using a “PageView=Shared&ToolPaneView=2” parameters in url (more info here)). All the files containing code are in a document library Sys.

image

Let’s see the samples:

Read the rest of this entry »

ads
ads
ads