Skip to main content

Posts

Showing posts from June, 2009

Display SharePoint Lookup column in custom application

The task We have a SharePoint list with a column of type Lookup. We also have an ASP .NET application where we need to display this SharePoint column as a drop down list. Solution 1. In your ASP .NET application inside the event where you create your controls - i.e. CreateChildControls event - write the following code: DropDownList drp = new DropDownList(); SPFieldLookup lkp = (SPFieldLookup)spField; Guid gG = new Guid(lkp.LookupList); SPWeb web = ... // initialize your SPWeb object try { SPList list = web.Lists[gG]; foreach (SPListItem item in list.Items) { ListItem litem = new ListItem(item[lkp.LookupField].ToString(), item["ID"].ToString()); drp.Items.Add(litem); } } catch { // put some error handling here... } this.Controls.Add(drp); // spField - is an object of type SPField you can initialize it like the following: // SPField spField = your_SharPoint_list.Fields[index or display name of your lookup column]; 2. If you want to save selected val

Working with Structured Data in MOSS 2007

I have recently worked on a project which involved InfoPath Forms Server and I've come across the following set of articles by Reza Alirezaei: Working with Structured Data in Microsoft Office SharePoint Server 2007 . It describes Configuring Single Sign On Service and Database, Exposing LOB Data, Browser enabled InfoPath Forms settings and some SharePoint Designer aspects in regard to the subject.

SharePoint Designer - Data Views - Using Server Variables as parameters

Today I have come across the task to filter a Form Library where one of the columns - which comes from InfoPath form - stores the login name of the SharePoint user. Like DOMAIN\account. I needed to filter the Form Library documents for current user. First I tried to use the filter column = [Current User] - didn't work. Then I have found the following article on SharePoint Designer Team Blog: Data View / Data Form: Parameters You Don’t Know About I have created a DataView parameter called UserLogin: and used it to filter the Form Library: That helped.