Perşembe, Ekim 28, 2010

SharePoint 2010 - Modal Pop-Up for a Unique Content Type

To continue the conversation with the modal pop up window, I was asked the following great question:

What if your list has different content types, each having their own form? Is there a way to make this pop-up specific to the form of a certain content type?”

The answer is yes it is quite easy to link the pop-up modal window to a unique content type: You would use the same approach but you would add in the Content Type ID to the end of the URL string:

<a onclick="javascript:NewItem2(event, &quot;http://sitename/_layouts/listform.aspx?PageType=8&amp;ListId={49E3BDCF-9C06-413D-A7B8-413F2E8F6B0D}&amp;ContentTypeId=0x01005C9243AA25668B4CAACB42C41B0D360600052ECA5C

javascript:return false;"

Add a Unique Content Type Item</a>

To find the custom content type ID, simply click on the list settings, within the content type section right click on the custom content type and then click on properties. Within the Address URL, the ID is at the very end after the “ctype=”

Simply Replace the above blue ID with your own custom one. This will allow you to have links to custom content types within the same list and not have to worry about the default content type settings.

Çarşamba, Ekim 27, 2010

SharePoint 2010 - Ways to extend the SharePoint Modal Window

So in my last post I simply wanted to show an input form in a SharePoint 2010 modal window. This got my creative juices flowing and I wanted to experiment a little. I found out that you can easily display anything in the Modal window that you wanted.

Web Site: Bing
<a onclick="javascript:NewItem2(event, &quot;;);
javascript:return false;" href="" target="_self">Show Bing In Modal Window</a>


<a onclick="javascript:NewItem2(event, &quot;http://sitename/Images/image.png&quot;);
javascript:return false;" href="/images/image.png/" target="_self">Show Image</a>


This does not really work since most video’s open up in a separate application like Window Media Player and not within the browser. However you can use things like flash .swf files to show in the modal window.
<a onclick="javascript:NewItem2(event, &quot;;);
javascript:return false;" href="" target="_self">Flash Game</a>


So basically you can show basically anything that you have a link to and can be visible within a browser.

Enjoy, and let me know what creative things you have placed in your modal window…

Salı, Ekim 26, 2010

D.I.S.C Kişilik Envanter Testi Sonuçlari–2010 için Yenilenmiştir sitesi üzerinde yapılan kişilik envanter testini doldurduktan sonra aldığım sonuçlar aşağıdaki gibi çıkmıştır. Sizin gerçek hareketleriniz ve davranışlarınızı tespit etme konusunda oldukça başarılı bir test. Benim sizlere tavsiyem 10 dakikanızı ayırıp bu testi doldurmanızdır.


•    Girişimci, iş geliştirici, değer katıcıdır.
•    Önemli kararlarda yer almak, lider olmak ister.
•    Sonuç odaklıdır, hızlı karar alır.
•    Sorumluluk taşır, direkt hareket eder ve konuşur.
•    İşbitirici ve otoriterdir; hatta bazen sert ve agresif olabilir.
•    İşleri hızlandırır, kolaylaştırır.
•    Katılımcıdır, göz önünde olmayı, meydan okumayı sever.
•    Fırsatları iyi değerlendirir, rakiplerini karşışına alabilir, rekabetçidir.
•    Başkalarının düşüncelerini önemser son kararı kendisi verir.
•    Olması gerektiği yerde her zaman bulunur.
•    Başkalarının kendisini dinlemesini ister.
•    Konsantrasyonunun kesilmesini istemez.

2009 yılı için hazırlanmış olan teste ise linkten ulaşabilirsiniz.

SharePoint 2010 - How To: Create Hyperlink to Modal Pop-Up Form

I was asked by a client recently if there was a way to create a hyperlink to a New Item Form anywhere within a site but still get the rich experience of the Modal pop-up window that grays out the background. (Note this is for SharePoint 2010 Only…)

I basically took the code directly from the “Add new item” and the “Add Document” link within the list view.

What this allows you to do is simply add in the following code to any content editor web part, Master page, or Page Layout in any site collection and display the form to be filled out. The user will get the nice experience of the modal window and not have to navigate away from their current page.


This could be used for example a feedback form that is included in the master page so whenever someone wants to give feedback it is always going back to a central list. The only that is required for you to know is the List ID and the site name.

Full Code For a List Item:
<a onclick="javascript:NewItem2(event, &quot;http://SiteName/_layouts/listform.aspx?PageType=8&amp;ListId={83747BB4-49C6-4181-B4A3-F8C6B611846D}&amp;RootFolder=&quot;);
javascript:return false;"
Submit Feedback</a>

Full Code for a Library Item:
<a href="http://SiteName/_layouts/Upload.aspx?List={94AC86A8-6774-4822-A197-A98542251678}&amp;
RootFolder=" onclick="javascript:NewItem2(event, &quot;http://SiteName/_layouts/Upload.aspx?List={94AC86A8-6774-4822-A197-A98542251678}&amp;RootFolder=&quot;);
javascript:return false;"
Upload a Document</a>

What you need to change:
URL: Change “SiteName” to your URL
List ID: Change the list ID to your custom list/library ID

  • To find out the list/library ID, simply navigate to the list/library you want to display and then click on list settings
  • Look at the end of the URL.
  • You will get something similar to this: %7B94AC86A8%2D6774%2D4822%2DA197%2DA98542251678%7D
  • Remove the first %7B and the last %7D
  • Then change all %2D’s to “-“
  • So the final would be 94AC86A8-6774-4822-A197-A98542251678

You could also add in an image right within the <a> tag and make a nice button for users to click on. Once you have customized the code you can now simply add the code to any page on the site and you will get the following results:

Site Collection 2 hyper linking to a list on Site Collection 1


Pazartesi, Ekim 25, 2010

SharePoint 2010 - How To: Hide Left Side Navigation on Home Page

I was recently asked: "How can I hide the side nav bar on the main homepage layout ?? I want to be able to use the side NAV with in the team site etc etc, but I don't want it on the front page.. "

There are a couple of ways to do this in SharePoint 2010. If you are using a non-publishing site you can add a Content Editor Web Part to the page and add the following to the HTML Source.

body #s4-leftpanel
display: none;
margin-left: 0px;

Basically the CSS above hides the left navigation Div, and then sets the content area to not have a left margin.

Once you are done, simply modify the web part and hide it on the page.


If you are using a publishing site for your homepage simply add the same styles specified above to a custom page layout. That way if you have a need for other pages that do not need the left side navigation you can re-use the page layout.

Pazar, Ekim 24, 2010

Visual guide to Windows Live ID authentication with SharePoint 2010 - part 1

Using Windows Live ID as login provider for SharePoint is a really huge thing. It makes the scenario for public facing web sites, extranets etc. much more easier, for instance there is no need to maintain passwords and users in the same degree. For SharePoint 2007 there is no native support for this, so I built a custom Live ID login provider (available at, but SharePoint 2010 has native support for claims based access. And that is what's on the menu for tonight...

This post, and the subsequent ones, will show you how to enable Windows Live ID on a SharePoint 2010 farm (SPF or SPS). I will do a visual approach using a lot of screenshots. It has not been an easy path since there are no official guidance on this subject (at the time of this writing), so I'm going to throw in a couple of steps where you can fail miserably while setting it up. Big thanks to Paul Schaeflein who also walked the hard path and took some hits to get this to work! Although there are a couple of available blog posts out there on this issue, some of the are very sparse on the details (why?) and some even contains faulty instructions. Just to safe up on this - the instructions works on my machines and I've been able to reproduce these steps a number of times. If you have any suggestions or comments, just leave them here and I'll try to (get someone to) answer them...

So what are we waiting for, let's get the party started. I have to warn you - if you don't like certificates - stop reading!


While I will explain more in details as we move along I think it is important to have a little heads up on claims based access and Windows Live ID. First of all (passive) claims based access is based on the simple scenario where a client/user (subject) trying to access a site (also called Relying Party/RP). This RP has distributed the login procedure to one or more trusted parties called Identity Providers (IP). In our case SharePoint is the RP and Live ID is the IP and you of course are the subject. When the subject tries to access the RP, the subject will be redirected to the IP where the actual logon process is taking place. By attaching cookies to the response and redirecting the user back to the RP with a set of (encrypted) claims the RP can finally authenticate the user. For a better understanding I recommend you to read A guide to Claims-based Identity and Access Control.

A little bit of claims

Windows Live ID (WLID) will take care of the login and send back a unique ID to the SharePoint site. This unique ID is the only claim WLID will give you. (Unfortunately you cannot get the correct e-mail address or the name of the user.) SharePoint will first verify the validity of the encrypted security token (containing the claims) before actually starting the AuthN and AuthZ process using the unique ID as username in SharePoint. You will later see how we give access to these unique ID's.

Another important thing to keep in mind is that WLID have two "zones"; INT and PROD. The PROD zone is what you normally use when logging in to Hotmail etc. The INT zone is used for development and testing and have a completely different account database, so you need to have accounts in the INT zone to continue, more about this in a little bit. You cannot skip the INT zone, you have to register your site there first before applying for approval in the PROD zone.

The steps provided here is only for the INT environment. For PROD it is basically the same and the post is long enough as it is...

Registering the site

MSMBefore even starting to configure the SharePoint site we need to register our site for usage with Windows Live ID. This is done using the Microsoft Service Manager web application located at You log in to this service using you normal (PROD) Windows Live ID account.

In the left menu click on Register Your Site (1). This will bring up the Register Your Site page where you should enter the name of your site, use a descriptive name (2) and the DNS Name of your site (3). The DNS Name is important! Here you must specify a DNS Name, which we will later change into a URI, or rather URN. Write something random such as

The DNS Name will be used as a SAML Audience when the security token is sent back and it will be verified by SharePoint. According to the SAML specification the audience must be a URI (a URN or URL). If you use a URL then WLID will for some reason remove the protocol from the audience when sending it back to the RP and SharePoint will throw an exception ([InvalidOperationException: This operation is not supported for a relative URI.] System.Uri.GetLeftPart(UriPartial part)). This might change in the future.

Finally you have to specify that you will use Windows Live ID (4). Click Submit to continue.


You will get a confirmation screen. Click Yes to confirm and proceed to the next step

MSM Confirmation

After a few seconds you will be presented with the results. If anything goes wrong you need to go back and edit your registration accordingly - but it shouldn't if you followed these steps.


Click on the Go to Manage Your Site link. In the drop-down (1) select the site that you just registered and then click on the Modify Editable Site Properties link (2).

Manage your site

The next screen allows you to edit the properties of the site. First of all check the Show advanced properties check box to enable more options.

Advanced stuff ahead...

First we need to rename the Domain name (1) and set our real domain name to use. Then we need to replace the dummy DNS name (2) with a URN, in this case I use urn:wictorslivesite:int. Remember not to specify a URL, it just won't work as of now. The third thing to edit is the Default Return Url (3); this must be an HTTPS url pointing to the /_trust/default.aspx page, for instance https://extranet.corp.local/_trust/default.aspx. This is the URL that the IP will post back the results to. Finally we have to edit the Expire Cookie URL (4). Just fix the URL and never mind the actual page (you can implement such a page if you feel to at a later time).

Options, options, options...

Then scroll down a bit on the page until you reach Override Authentication Policy, this step is crucial. Select MBI_FED_SSL in the drop-down. And when you're done click Submit (at the top of the page).


Verify and confirm your changes by clicking Yes on the next screen. Take a screenshot and/or notes all these changes.

Confirmation again

That's it. Your site is now configured. Actually you can configure a bunch of more features here - but stick to these as of now...


Let's move on to the SharePoint Server.


Claims based authentication uses certificates for encryption and signing and you have to trust the certificate of the IP on your SharePoint servers. The following steps must be done on all WFE's in the farm.

To get the IP certificate; browse to federation metadata URL: (this is for the INT zone). Then copy the inner text from the first X509Certificate node. Open up the Notepad application and paste the text and then save the file as LiveID-INT.cer. Make sure that you only get the inner text of the element.

XML en masse

Now you have the certificate in a file and you need to import it to the correct locations on the SharePoint Server(s). It is actually required to be stored locally on three different locations. Open mmc.exe and add the Certificates snap-in. When you select to add it you must first select to use the Computer Account to manage the accounts for and select to use the Local computer as computer to manage.

Expand the tree until you reach SharePoint > Certificates then right-click on the node and Select All Tasks > Import...


In the import wizard that appears locate the LiveID-INT.cer file you just created and then click Next > Next > Finish. That's the first one.

Repeat this procedure for the Trusted Root Certification Authority and Trusted People. Don't worry if you don't have a Certificates sub-node. It will be created when you import the certificate.

Even more certificates

Now we're one step closer and it is time to get dirty with some PowerShell. You could of course have done this step using PowerShell, but I leave that for another crafty blogger to show how... Just remember to do this on all WFE's!

Create the STS provider

To create the Trusted Identity Token Issuer, that we will use to configure as the login provider for the Web Applications, we fire up PowerShell. This step will not be that "visual" as the previous ones, since none of these commands can be run using the standard SharePoint user interface. I guess it's just a matter of time until someone makes a neat add-on with these simple commands...

I'll give you the script first and then explains all the involved steps:

1: asnp microsoft.sharepoint.powershell
2: $realm = "urn:wictorslivesite:int"
3: $certfile = "C:\Temp\LiveID-INT.cer"
4: $rootcert = Get-PfxCertificate $certfile
5: New-SPTrustedRootAuthority "Live ID INT Root Authority" -Certificate $rootcert
6: $emailclaim = New-SPClaimTypeMapping
-IncomingClaimType ""
-IncomingClaimTypeDisplayName ""
7: $upnclaim = New-SPClaimTypeMapping
-IncomingClaimType "
-IncomingClaimTypeDisplayName "UPN"
-LocalClaimType ""
8: $authp = New-SPTrustedIdentityTokenIssuer -Name "LiveID INT"
-Description "LiveID INT" -Realm $realm -ImportTrustCertificate $certfile
-ClaimsMappings $emailclaim,$upnclaim -SignInUrl "
-IdentifierClaim "

The first line just loads the SharePoint PowerShell Snapin (1), asnp is a shortcut for Add-PSSnapin and saves you a cpl of keystrokes. Then we set three local properties; realm corresponds to the DNS Name (that is the URN), certfile points to the location where you saved the LiveID-INT.cer file and the rootcert is the certificate loaded in as an object.

Make sure not to make any typos in the claims URN's - been there, done that!

Then we add the certificate to a SharePoint trusted Root Authority, using the New-SPTrustedRootAuthority cmdlet. You can verify that it is correctly imported by going to Central Adminitration > Security > Manage Trust:

Trusts in SharePoint

Then we need to create two claims mappings; one for e-mail (line 6) and one for the identifier (line 7). The claim mappings defines how the incoming claims are mapped to the SharePoint tokens. These two claims are then sent into the New-SPTrustedIdentityProvider cmdlet (line 8) and here is where the magic happens. This cmdlet creates a new trusted identity provider with a name and description, we instruct it which claims mappings to use and which claim is the identifier claim. We are also specifying the URL for the WLID (INT zone) login page.

Once these commands are executed, we are ready to head on over to the UI and create a Web Application. By all means, if you prefer to do the rest using PowerShell, feel free to do it.

If you are fiddling back and forwards using different registered Live ID services, you can switch the Realm using the DefaultProviderRealm property of the Trusted Identity Provider object (authp). Don't forget to call Update() on the object... You can only have one provider for each service, even if the realms differ.

Create the Web Application

Fire up Central Administration and go to Application Management > Manage web applications. Click New to create a new Web Application.

First of all you need to select to use Claims Based Authentication. Then enter a Name for your web application, use the port 443 (SSL) and (in this case) configure the host header to match the domain name that you entered while registering the WLID service. Just standard stuff so far.

Create the web application

Under Security Configuration make sure that you select Use Secure Sockets Layer (SSL).

SSL settings

Under Claims Authentication Types leave Windows Authentication enabled if you like, but make sure to check Trusted Identity Provider checkbox and then check the LiveID INT provider, the one we created using PowerShell.


Once done click OK to create the Web Application.

We're almost there just a few steps more...

Create the Site Collection

Once the Web Application is created you can directly click on the Create Site Collection link. Enter name and description for the site, and also specify which template to use.

Now it is time to give some permissions to this site collection. Assume that we did not select any Windows Authentication when creating the Web Application, then we can only add Live ID users, right?

If you don't have a WLID account in the INT domain it is time to get one now. Open up a new browser window. Go to and sign up for a new account or sign in using one of your existing INT accounts. (Stability of the INT domains are not 100% :-). When you have signed up or logged in click on Credentials and then View your unique ID.


You will now see a screen with your unique ID; write it down, copy it or remember it...

Magin number

Close the browser and return to the Central Administration where you started creating a Site Collection. Now paste or write this unique ID and append in the Primary Site Collection Administrator. But, make sure to convert all characters to lowercase, otherwise you will not be able to log in later:

Magic number becomes an admin

Then click OK to create the Site Collection.

Final configurations

Before browsing to the site we need to make some final adjustment in the IIS. To be precise we will add a certificate to the site. You can use a certificate that you have acquired for your site or when testing just use a Self-Signed, which I will show you here.

To create a Self-Signed certificate start the IIS Manager and select the server. In the Features View double-click the Server Certificates module.

Ouch, more certificates

Then click Create Self-Signed Certificate in the Actions bar to the right and follow the instructions. Mostly next-next-finish.

I'll make one myself

The final configuration is to use this certificate on the Web Application. Choose the Web Application you created in SharePoint in the IIS Manager (1), then click on Bindings (2), select to edit the only binding you have (3) and choose the SSL certificate you just created in the drop-down (4). Click OK and close everything down.

Advanced stuff

That's it! Let's see how it behaves...

Taking it for a test drive

Now open up a web browser and go to the web application you have created using the domain name you specified when creating it, make sure to use https. You should see the standard warning in the browser that the certificate is not valid (add it as trusted if you want to skip this warning in the future), otherwise just click the continue link.

Bump, we just hit a certificate again...

If you have several authentication providers you will see the new SharePoint 2010 Sign In screen with a drop-down where you can choose the authentication provider you would like to use to log in with. If you only have one, in this case the WLID, you will be redirected to the WLID Log In screen - the same will happen if you select LiveID in the drop-down.

Signing in...

If you get an error stating We're unable to complete your request, like below, you most certainly have not used the correct Realm when creating the trusted identity provider using PowerShell. Make sure that the Realm and the DNS Name in the Live ID Service Manager are exactly the same, case sensitive and all.

Ooops, you made a mistake!

The Windows Live ID sign in screen should look as expected, just the same as logging in to other Live ID services. Enter your INT username and password (remember this is still the INT zone).

We're getting there

If you remembered your username and password correctly you will very soon see the beautiful SharePoint 2010 scenery:

Ahhh. So beatiful!

Note that your username and display name will be exactly the same as the unique id you have for that user. How to fix this is scheduled for a later post :)

Next steps

So, there you have it. It's a handful of steps to complete and you have to make sure not to mistype anything. I will continue this series with some more info that could be of great use when setting this up - hopefully not as long as this one though...

SharePoint 2010 - Customizing and branding the wiki pages for a Team Site

I am examining the SharePoint 2010 architecture in order to find the best ways to customize the Wiki Pages of a Team Site. In this post we will focus on two kinds of elements:

  • The SharePoint 2010 Ribbon and how are populated the Styles and Markup Styles Menu
  • Some of the SharePoint 2010 templates, including the v4.master Master Page and the Team Site Wiki Page Template, wkpstd.aspx

Important: do not mistake a Wiki Page of a Team Site for a Wiki Page of an Enterprise Wiki. They are totally different since an Entreprise Wiki is a kind of publishing site, and a Wiki Page of an Enterprise Wiki can be based on different Wiki Page Templates.

In this post, I am examining the Wiki Pages for a Team Site so that this information can be used for SharePoint foundation 2010.

For more information about Enterprise Wiki:

Enterprise Wikis overview (SharePoint Server 2010)
ContentTypeId.EnterpriseWikiPage Property
SPC: Customizing Enterprise Wikis in SharePoint 2010 with Gail Jacoby & Ted Pattison

1 - Managing the Styles and Markup Styles Menu Items

One important thing to kow is that these items are populated dynamically, client side, using the JavaScript loaded by the SharePoint 2010 Ribbon, and I am now going to show how to see it in action.

1.1 - Debugging the SharePoint 2010 Ribbon

We are going to debug the JavaScript of the Ribbon while using IE8 in order to see how the menu are populated, so let us start by adding a new Style menu item.
Add an HTML form Web Part in a SharePoint 2010 wiki page in order to be allowed to insert some HTML within the page and add an style tag with a ms-rteStyle so that the menu can be able to load this style as a new item.

Then open the Tools menu of IE8 and locate the Developer Tools

Open the Developer Tools and hit the Script Tab

There is not much scripts loaded for the moment but activate the Edit mode for the page.

You will notice that activating the Edit Mode leads to the load of several files, but locate the following:


Open it
locate this line (12890) RTE.StyleRuleUtility.$u = function($p0, $p1, $p2)
and set the following breakpoint:

  • sp.ui.rte.debug.js -->

    Place a breakpoint in front of
    the first line
    if (!$p0.startsWith('.')) {

The goal now is to force SharePoint 2010 to load the styles, so Save & Close the page, empty the temporary internet files, add a custom style to one of the CSS files.

Now, hit the "Start Debugging" button in the Developer Tools
then, go back to the wiki page and activate the Edit Mode.

The tool starts debugging and stops on the breakpoint.
Continue to press F11, and you will be taken to a resource file that seems to validate some parameters, then when you come back to the script, you notice that a variable has been initialized to look for the ms-rte class elements.

Then the url for the first css file is retrieved

Then, this is AMAZING! the JavaScript of the Ribbon is loading the content of the CSS file by using an AJAX request with the XMLHttpRequest object.
You will notice the responseText variable with all the CSS classes loaded!

Then it is the turn of the wiki.css

and the corev4.css

finally I had a custom styles CSS, and you will see that I have placed the ms-rteStyle-Normal inside of it

Then the JavaScript starts loading the classes available within the page, first these two that are located in the <head> tag:

<style type="text/css">

{ border-color:Black;border-width:1px;border-style:Solid; }

{ border-color:Black;border-width:1px;border-style:Solid; }


Then the JavaScript finds the custom style I have placed within the HTML Form web Part

and stores the inner and outer html of it

and the class name

Conclusion: as the styles are loaded dynamically from all the places where you can store CSS classes, we don't have to worry about coding to manage the Styles and Markup Menus items, but just to focus on the good way of storing and referencing our CSS.

1.2 - Storing and registering the SharePoint 2010 CSS

- At the wiki page level.

With MOSS 2007, when creating a portal, we were sometimes hesitating between using the collaborative part of SharePoint (the lists, the pages, the Web Part pages), and the integrated CMS (Web Content Management). Both had benefits and drawbacks, and it seems that, in SharePoint 2010 the Wiki Pages of a Team Site are now closer to a WCM Page Layout than ever because the layout of the page has been dramatically improved.

However, the wiki pages of a Team Site don't seem to have been designed to be customized, and it is perfectly normal because there is a customizable version of the Wiki Pages in Sharepoint Server 2010: the Wiki Pages of the Enterprise Wiki.

Now this precision has been made, let us examine the limitations of the Wiki Pages for a Team Site:

First of all if you unghost a Wiki Page, the page UI will be spoiled by a  premanent warning message.

Second, you cannot create other Wiki Page Templates and make them available for the end users when they want to create pages although it is possible with the Page Layouts and for the Wiki Pages of the SharePoint 2010 Enterprise Wiki.
When you create a Wiki Page within a team Site by using the SharePoint 2010 UI, the product use the method
SPFileCollection.Add( String,SPTemplateFileType)

It is the only method that can produce ghosted files within SharePoint 2010. The available tempates are:

  1. StandardPage
  2. WikiPage
  3. FormPage

and as you can see in the following screen shot of relector, the reference to the Wiki Page template is hardcoded, so there always will be only one template for the wiki pages of a Team Site, the one that is located at DocumentTemplates\wkpstd.aspx

Of course you can customize the Wiki Pages of a Team Site and let them in a ghosted state by deploying them with a feature, but you will have to upgrade and activate your feature each time you need another custom wiki page, and you will lose the benefit of letting end users create the pages by themselves

This is, at first, a bit puzzling, especially because, as the JavaScript of the SharePoint 2010 Ribbon is loading dynamically the CSS classes to populate the Styles and Markup menus within a Wiki Page, we were expecting to a native way of referencing the CSS at the level of the Wiki Page without that it could be modified by a contributor. Here again, we cannot do it although it is possible wiht a Page Layout and for the Wiki Pages of the Entreprise Wiki.

However, if you want to reference a custom CSS for one or several wiki pages of a Team Site at the level of the page without modifying the template, I have found a means to do it using a delegate control.

Unfortunately, it will not be enough to use this trick to manage the items of the Styles and Markup since you have first to REMOVE those that are delivered with the Out Of The Box version of SharePoint 2010 ie the native SharePoint 2010 ms-rteStyle and ms-rteElement classes (ms-rteStyle-Normal, ms-rteStyle-Highlight, ms-rteStyle-Byline,....,, .ms-rteElement-H1, etc.) that are located within the corev4.css file.
(You could try anyway to use this trick to programmatically specify an alternate CSS for the site at the level of the Wiki Page, but I think it is not a good idea).

- At the Master Page level

Because we will need most of the time when branding a SharePoint 2010 site using wiki pages, to at least, remove the native ms-rteSyle and ms-rteElement classes located in the Themable/corev4.css folder and to replace them by our customn classes, we will use most of the time an alternate CSS, either by specifying it within the SharePoint Server 2010 UI, or programmatically for SharePoint 2010 foundation.

It is a very bad idea when wanting to replace the SharePoint 2010 corev4.css by a custom one to remove the CSSLink control within a Master Page and to render a custom LINK tag or to hardcode it because the CSSLink web control renders some other useful LINK for the search, and the new SharePoint 2010 dialogs, and also manages the new SharePoint 2010 themes. 
So, in SharePoint 2010, when referencing any CSS it becomes quite mandatory to use the CSSLink and the CSSRegistration controls, because of the new themes.