Skip to main content
 
Go Search
Home
Categories
Bloggers
By: Raja Ayyapusetty | Posted: December 24, 2009 at 10:10 AM

To enable the scope picker next to search input box I started off with the 2007 approach of writing a custom feature and giving it higher priority as mentioned in this MSDN article. Even after setting the search control’s DropDownModeEx property to “ShowDD” it wasn’t displaying the dropdown. After some struggle I stumbled up on the search settings option under site collection settings. As shown in the screenshot below, it gives us an option to show or hide the scope picker next to the search input box.

SP2010_ScopePicker

Hope this helps.

By: Raja Ayyapusetty | Posted: March 25, 2009 at 9:19 PM

To reference Javascript files in web parts, I’ve seen people adding them as embedded resources to the web part assembly. Problem is, simple updates to the Javascript in those files requires redeployment of the DLL and an iisreset.

Another way of referencing JS files is doing the below in CreateChildControls method. This way you can make updates to JS file independent of the web part assembly.

Literal ltlJS = new Literal();
ltlJS.Text = "<script type=\"text/javascript\" src=\"" + SPContext.Current.Web.Url + "/_layouts/inc/Test.Js\"></script>";
this.Page.Header.Controls.Add(ltlJS);
By: Raja Ayyapusetty | Posted: May 19, 2008 at 3:23 PM

MSDN has a very good article to customize list forms in 2003. This post explains how to do the same in 2007. I won't be going through the steps for creating a custom list definition; there are many good articles for that.

In 2007 SharePoint, List pages for all the lists are rendered using 2 layout pages in 12\Template\Pages folder: form.aspx and viewpage.aspx. Similar to how a publishing page is rendered, SharePoint uses the default.master and "form.aspx" to render NewForm/DispForm/EditForm pages while AllItems.aspx page is rendered using "viewPage.aspx" layout. So, any changes to those two layout pages gets reflected in all the lists/document libraries in all SharePoint web applications on that server. When I said ALL lists..I lied :); Picture Library is an exception here, It has its own set of pages.

To have custom list pages for a custom list definition, just like the Picture Library, it needs to have its own set of pages. The only trick here is to make your list definition use those pages. We'll follow Picture Library's Schema.xml to associate custom pages to the custom list definition:

  • Copy AllItems.aspx, DispForm.aspx and EditForm.aspx from Features\PictureLibrary\PicLib folder in to your custom list definition feature folder that contains the list schema.xml. Picture Library has Upload.aspx but no NewForm.aspx.
  • Create NewForm.aspx by making a copy of AllItems.aspx (you can use DispForm or EditForm.aspx also) and rename it to "NewForm.aspx".
  • Make your customizations to these pages. In my case, I created a list definition which had a custom web part in all the pages.
  • Open Schema.xml and update the <Forms> section to delete the "SetupPath" attribute from the Form nodes as shown below.

<Forms>
  <Form Type="DisplayForm" Url="DispForm.aspx" WebPartZoneID="Main" />
  <Form Type="EditForm" Url="EditForm.aspx" WebPartZoneID="Main" />
  <Form Type="NewForm" Url="NewForm.aspx" WebPartZoneID="Main" />
</Forms>

  • By deleting the "SetupPath" attribute, we are telling SharePoint to look for ".aspx" pages named after the "Type" attribute in the same folder as Schema.xml.
  • "AllItems.aspx" is associated with the default view of the list. Similar to the above change, delete "SetupPath" attribute from the default view node in the schema.
  • Save your changes and install the feature.

That is all you need to do.

By: Raja Ayyapusetty | Posted: March 20, 2008 at 6:38 PM

If you add a lookup column to a list/library from UI, it allows you only to pull information from a list within the same Web. However, if you need a lookup column to pull from a list in any web in the same site collection, you can do so through code. AddFieldAsXml method of SPFieldCollection, as shown below, does the trick for us:

string fieldXML = "<Field DisplayName='MyLookUpColumn' Type='Lookup' Required='FALSE' List='" + listThatHoldsLookupData.ID + "' WebId='" + webThatHoldsLookUpDataList.ID + "' Name='MylookUpColumn' ShowField='" +  Internal Name of data source column + "' />";       
list.Fields.AddFieldAsXml(fieldXML, true, SPAddFieldOptions.AddFieldToDefaultView);

After adding cross-web lookup column as above, you can change the source column from UI but not the source List. Make sure that you are providing the internal name of the data source column for ShowField attribute.

By: Raja Ayyapusetty | Posted: January 14, 2008 at 11:40 AM

This post is about a recent interesting observation with people picker. After using Windows authentication for a while we switched to forms authentication with custom membership provider. Now when we used people picker, it was displaying the custom membership provider users, which is expected, and also the domain users! This was confusing. After doing little research on the people picker control found that it uses PeopleEditor class and the places it looks for users is driven by the AccountType property. It is an enumeration with possible values of: "DL, SecGroup, SPGroup, User". There is no explanation on MSDN about what each value stands for but there are few guesses in the community content section; listed below:

DL - Distribution List. AD or the custom membership provider

SecGroup - AD Security Group.

SPGroup - SharePoint Group

User - Single User. Here my guess is, single users are all the users that you see under "All People". These are the users who have accessed a Web at least once.

You can set the AccountType property with a comma separated string of above values. My guess is PeopleEditor.AccountType property is set to "DL, SecGroup, SPGroup, User" to search for all possible users. Once I deleted all the domain users from All People I'm getting just the custom membership provider users. This kind of asserts my guess about AccountType.User.

 

 About Raja Ayyapusetty

Senior ConsultantRaja Ayyapusetty is a senior consultant for PointBridge. He has over three years of experience in Microsoft .NET technologies with a primary focus in designing and developing 2003/2007 SharePoint solu... [more]

 Tag Cloud

 External Links

 ‭(Hidden)‬ Admin Links