Archive for November 14, 2012

Editing SPView objects

SharePoint Short #14

Making a change to a SPView object directly will not work:

listObject.DefaultView.Title = "new title";

What you should do is instantiate a new variable from the view you want to make changes to:

SPView view = listObject.DefaultView;
view.Title = "new title";

Enhanced Lookup Field – Part 3

This is part three of the post on how to create a custom lookup field for SharePoint.

Other pages in this post are:

For this post, I’ll describe the implementation of the field control class.

Read more

Handling Long Operations

SharePoint Short #13

Got some code that may take a while to complete? Good idea to let the user know they may have to wait a while, so put your code within the SPLongOperation block, as shown below, and it’s problem solved.

using(SPLongOperation longOperation = new SPLongOperation(Page))
    longOperation.LeadingHTML = "Please wait while the operation completes...";
        // Operations that may take a while to complete...
        longOperation.End("somepage.aspx", SPRedirectFlags.Static | SPRedirectFlags.RelativeToLayoutsPage | SPRedirectFlags.Trusted, System.Web.HttpContext.Current, string.Empty);

Get every new post delivered to your Inbox

Join other followers: