Sharepoint 2010 – How to create a test environment for free

Sharepoint is one of the main pillars in Microsofts web/intranet strategies.   So I decided to poke around and take a look at the SharePoint 2010 Server.  I’ve had run ins with sharepoint 2007 before, but now i wanted to setup some kind “sandpit” environment on my home laptop. Now i don’t have the means to buy sharepoint or any other related software, i just wanted to play. (c:

And that is possible. The cool thing is that  Microsoft provides trail version of most of its software with astounding 180 day trail period. More then enough time you need to get acquainted with the thing.  There’s is a catch thou, to download trail software you have to be registered Microsoft- technet  user.  Of course if you are paranoid you would’t register you self, because Microsoft are evil he he,..  But no more fulling around ,.. lets get to busies ,..

Go to the http://technet.microsoft.com/ and login. If you are not a user create one here, no biggie.  When that’s done  you have to prepare the necessary software (iso files to be prefered)

Now but you will probably say VM Virtual BOX wtf.. mickrosoft has made a complete 2010 Information Worker Demonstration and Evaluation Virtual Machine (SP1) with all that you need Sahrepoint 2010, Office and windows  Server 2008 just download and use ,..  yea been there done that. But i was a bit disappointed.

Her’s a quote from the bottom of that page “The Virtual Machines contained in this package are 180 day evaluations. Additionally they will require activation, or re-arming, after a 10 day period after which they will shut down after 2 hours of continuous operation.” Not quite what i was looking for..

So start by installing  VM Virtual BOX, If you haven’t played with Virtual box before  just follow this tutorials

  1. http://youtu.be/XgE4BHtLfcY
  2. http://youtu.be/V4Rc-wKvIwE

By now you have installed a trial version of windows 2008 server on your VM Virtual BOX, time to proceed to installing the required software

  1. (not mandatory if you just want to play) Installing Active Directory by running DCPROMO command in the start> run feature.
  2. (not mandatory) Install office pack.
  3. Install Sharepoint Prerequisites (this will install SQL Server and IIS)
  4. Install Sharepoint Server (her’s a good tutorial )

And there you have it, a free playground at your fingertips. You could install further software to enhance your playground, like visual studio (c:

Things to remember when using Membership.UpdateUser(MembershipUser user)

You got to love programming it thows you one curve ball efter another (c: thats why i love it so ,..
Her is a good thing to remember,.  when updating membership users, Lets say you want to do something like this

user.IsApproved = true;  //reactivate user
user.Comment = “mjau”; //change comment
Membership.UpdateUser(user);

this code will run just fine, but the result is not what you would expect
When it executes it will only update user.Comment = “mjau” on the other hand user.IsApproved will never be updated.
To make it work you must call Membership.UpdateUser() everytime you make an update, like this.

user.IsApproved = true;  //reactivate user
Membership.UpdateUser(user);

user.Comment = “mjau”; //change comment
Membership.UpdateUser(user);

Well,  that is my conclusion after some trail and error  runs

happy coding

Edit: Check out Sky Sanders Solution for this problem:  http://stackoverflow.com/questions/2721658/membership-updateuser-not-really-updating-the-database/2722173#2722173

401 UNAUTHORIZED – error when developing a costume login for sharepoint

Developing sharepoint is fun its like a box of chokolads, you never know what you are goint to get (c:
I was trying to make an alternative login site because the original version is a bit boring to look at. So
after i programed all the .net fluff it was time to port it to sharepoint. and it is here fun begins.

To start with one thing to remember is that sharepoint uses a Masterpages, that’s the easy part
next where to poot your code files.  someware in the 12 hive say you,.. yes (c: and here you should stop
and read one of my other articles ,  and this one as weel.

You can still use Sharepoint designer, but i must admit visual studio is that much better(just a sidenote).
Ones you have read both artickes here is what i did.
1) make a copy of the mobile login aspx, located here(yourDrive:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\LAYOUTS\MOBILE\mbllogin.aspx). When you remove all the mobile code it is much simpler then the one located in layputs folder.
2) Make a new folder in this directory (yourDrive:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\LAYOUTS)
3) put your asp files and the copy of the mbllogin.aspx
3.a) rename mbllogin.aspx to  login.aspx
4) Open your webconfic and replace the default login page with yours here is a snipit
<authentication mode=”Forms”>
<forms loginUrl=”/_layouts/mjauDirectury/login.aspx” />
</authentication>

5) now you can costumize and merge your .net code with sharepoint (c:

NOW here you get your 401 UNAUTHORIZED and happy days,.. you are stuck.
but there is a way to remedy this. (c: here what i did.

The 401 UNAUTHORIZED error was generated, when my code was reading data  using
sharepoint SPSite, dispite of.. that my assembly was added as a trusted resource in webconfic (read 4.d ),..
damn ,.. any way here is how i solved it:

Put all your code inside one og thouse bad boys

SPSecurity.RunWithElevatedPrivileges(delegate()
{
using (SPSite sitecol = new SPSite(rootSiteUrl))
{
// do your stuff here
}
});

the rootSiteUrl is the url of your sharepoint site (c:
that’s the way i did it,. if you have a better one ,..
tell me (c:

and you are done,.. Happy Coding

SharePoint – deploying a Webform

I am new to this new and exiting world of sharepoint, and i like it so far (c: but no pain no gain ,..
so this my expirience so far. I installed the lates version of Sharepoint designer ,.. and this is where fun beguins

One of my fist challenges was to an asp.net 2.0 webform to sharepoint and this is what i did,..

1) start runing around like GRAZZZYY,,..
2) make your asp.net code,. when it works
3) Set up your version of SharePoint to display errors, if you don’t you’l end up with nothing but “An unexpected error has occurred”
3.a) in webconfic change <SafeMode MaxControls=“200“ CallStack=“false“… to <SafeMode MaxControls=“200“ CallStack=“true“…
3.b) <customErrors mode=“Off“/>
4)Next problem is how to you add code behind to your aspxes
4.a) Build your WebPart and copy dll to your sharoint solution bin folder.
4.b) In Sharepoint designer, create your aspx page and copy your code in to it.
4.c) Change Inherits if nead to,.. remember class first then assembly.
4.d) In Webconfic add folowing

<SafeControl Assembly=”myassembly.name” Namespace=”myNAMESPACE.name” TypeName=”*” Safe=”True” /> this enabeles all your aspxes which uses this namespace for sharepoint.
4.e) In Webconfic change CallStack=”false” to CallStack=”true” in <SharePoint><SafeMode>
4.f) In Webconfic add folowing to <SafeMode><PageParserPaths>
<PageParserPath VirtualPath=”/*” CompilationMode=”Always” AllowServerSideScript=”true” IncludeSubFolders=”true” />
this enabels all event handeling for buttons and others.

and this is it ,.. You have done it ,..
by the way thanks to Will for a briliant article it was a big help ,.. i can recomend you to read it ,..
http://blogs.vertigo.com/personal/willa/Blog/Lists/Categories/Category.aspx?Name=SharePoint%202007

over and out ..