Showing posts with label SharePoint. Show all posts
Showing posts with label SharePoint. Show all posts

Wednesday, December 2, 2009

Changing the Forms of your SPList in WSS/MOSS 2007

Had been browsing the web and found no good solution to this, I think I’ll write about this instead.

Basically the whole idea is to change the Display/Edit/New form of a specific list to point to another page, rather then the default NewForm.aspx or EditForm.aspx or DispForm.aspx (for custom lists for example). And would like to do so without going through all the pain of creating a new list definition.

Now, a quick solution would be to use SharePoint designer, where you can change those form’s URL directly through the List Property. However, a caveat, you are only allowed to point the form URL to a page that exists in the current web. In other words, you cannot point them to custom pages you deployed _layouts folder. A possible solution here might be writing ‘stub’ pages, that will further redirect users using javascript to the correct _layouts pages.

Another more elegant solution would be to change the forms’ URL programmatically through SharePoint DOM. However, take note that SPForm object cannot be modified. For example, the following will give you error:

SPForm newForm = list.Forms[PAGETYPE.PAGE_NEWFORM];
newForm.Url = "xxxxx";

Now, the fun part is, although SPList’s forms do not change,  SPContentType allows you do to so! The solutions I have is:

  1. Configure the list so that it supports ContentType (in advance list settings). For Custom List, this will create a content type named “Item” and content type named “Folder” for this particular list
  2. Using powershell/other coding means, do the following:

SPContentType ct = list.ContentTypes[0]; //assume it is the first
ct.NewFormUrl = "_layouts/MyNewForm.aspx";
ct.EditFormUrl = "_layouts/MyEditForm.aspx";
ct.DisplayFormUrl = "_layouts/MyDisplayForm.aspx";
ct.Update();

Now, this particular list will use the correct pages you deployed in the layouts folder!

Tuesday, November 24, 2009

My SharePoint Server 2010 is fast!

Finally! Manage to get SharePoint Server 2010 to run (fast)!! As an attempt to try SharePoint Server 2010, and to avoid multiple servers (at this moment), I decided to setup SharePoint Server 2010 in standalone mode (using SQL Express). Tried it on a Hyper-v VM with Windows 2008 R2 (with Hotfix: 166231), the server is crawling (like a turtle that is, not crawling as in FAST indexing) with 1GB ram setup.

I guess it would be correct to assume that SharePoint 2010 will run a lot faster if I just assign more RAM to the VM. [UPDATE (27 Dec): Yeap, confirmed, assigned 2gb to the VM, SharePoint 2010 works quite fine] However, why stop here? I tried a totally radical approach instead: BOOT-VHD. Now my SharePoint 2010 is literary flying in my Laptop of 4GB ram with direct hardware access! summary of steps I did as following:

  1. Prepare Windows 2008 R2 VM using Hyper-v
  2. Use BCDEDIT to mount the VHD into boot menu.
  3. Boot into the vhd [note 1]
  4. Install relevant drivers
  5. Install pre-requisites for SharePoint Server 2010
  6. Install hotfix 166231
  7. Install SharePoint Server 2010 (standalone)
  8. SharePoint 2010 flies :D Nice!

Anyway, Reza Alirezaei’s article is a great source of reference:
http://blogs.devhorizon.com/reza/?p=989
I followed his steps and success except that I did not Sysprep (as I am running the VHD in the same laptop, and it works in my case without sysprep).

note 1: In step 3, I got a 0x00000136 Blue Screen, (“VHD does not have enough free space to expand the vhd”) after select to boot into the VHD in the boot menu. Now this is an interesting one, seems like when you boot into vhd, the disk size you specified for the VHD will be ‘virtually’ pre-allocated in the drive. Note, it is the size you specified during creation of the VHD, not the actual disk space it uses. My VHD is ‘virtually’ 120GB, but physically only around 7GB, but i still need at least 120GB free on the drive that i stored the VHD for it to boot success… Also worth notice, when I booted into the VHD, other drives (physical harddisk drive) are also visible, and I notice the drive storing the vhd have 120GB less of space, which is ‘virtually’ pre-allocated. When i booted back to my host OS, those spaces are still available for use.

Thursday, November 19, 2009

No Luck on SharePoint Server 2010

Well, my installation of SharePoint Server 2010 failed. It is not supported in Windows Server 2008 R2 yet... found out the hard way, sigh...

Required some sort of service pack for Windows Server 2008 R2

http://blogs.msdn.com/opal/archive/2009/11/16/installation-notice-for-sharepoint-2010-public-beta.aspx

Time to roll back to good-old SharePoint Foundation.

Wednesday, November 18, 2009

Here comes SharePoint Foundation (beta)

Just got SharePoint Foundation 2010 up and running!

image

It sure takes a lot of RAM! maybe its because of the x64.

Installation generally went well, the SharePoint Foundation installation got stuck in the last stage “Applying Updates…” for around 50 minutes, but it continued on and completes as usual.

SharePoint Configuration Utility for SharePoint Foundation failed for the first time around step 8, weird error, “User not found” some where at the configuration database, captured in the log file. However, I re-run the configuration utility, and it works fine!

Now to shutdown the VPC and give it more RAM before I install SharePoint Server 2010.

Thursday, October 29, 2009

<Lt> and <Gt> CAML Mess!

Ok, CAML SharePoint, we had came to love (and hate). The darn thing still surprises me even after few years of regular use! Okay maybe I am not technical enough, let me explain, and you judge!

Was dealing with some date/time checking, and came came across the need to compare some dates, the initial query as following:

<Where>
  <
Lt>
    <
FieldRef Name='StartDate' />
    <
Value Type='DateTime' IncludeTimeValue='true'>{0}</Value>
  </
Lt>
</
Where>

Okay, this executes and give me all data where with StartDate < {0}. As expected, so far. Now, the business logic changed, I would need to get the opposites instead: {0} < StartDate, so, I did some small logical change on the xml by reversing the FiedRef and Value tags’ position:

<Where>
  <
Lt>
    <Value Type='DateTime' IncludeTimeValue='true'>{0}</Value>
    <FieldRef Name='StartDate' />
  </
Lt>
</
Where>

Logic? No!!! To my horror, this query gives me the exact same result as previous!!!!  I am shooting myself in the foot, I should just use Gt instead of changing the order… Anyway, now only I learnt (after 5 years using CAML), that <Lt> and <Gt> does not honors the order of the elements inside!!! It will always return FieldRef Gt/Lt Value. *Ouch*

Nice catch CAML, nice one.

Wednesday, October 28, 2009

Back from SharePoint Conference 2010, Las Vegas

And the big news is… I lost $50 to the slot machines.

BTW, nice conference, lots of great people presenting, socialized with quite some participants there that have very huge SharePoint deployments. Developers and end-users a likes, SharePoint ‘culture’ in US is definitely much more mature then here in Asia. Saw quite good custom solutions at the partners’ pavilions. Quite a good experience for this trip.

SharePoint 2010 will be a big release when it is out. Too much to talk about in a blog post. Anyway, the feature that caught my imagination the most is the Client OM and REST interface for development. More to blog about when i get the beta in November.