Ideas for Free

Ideas for Free

only freedom gives SharePoint real power to grow

Ideas for Free RSS Feed
 

Archive for Howto

Office Server 2010: How to install SPS2010 in Single Box Development Server

English

SharePoint 2010 relies on 64 bit infrastructure and higher hardware specifications, where it is not always affordable for freelance consultant to upgrade existing laptop for that requirement. Then, a single box development server will become a choice. Sometimes, it also mean for simplification where everything run in the same box ; Domain Server – SQL Server 2008 – SharePoint 2010 – Office 2010 and Visual Studio 2010. There is nothing special when installing or configuring those roles / application in the server , EXCEPT SharePoint 2010 installation process will strangefully follow different path. There will be no selection on the installation type anymore. You will not be prompted for Standalone or Farm installation option anymore.

How to install SPS2010 in Single Box Development Server?

1.  After you have finished installing OS, start to add Active Directory Domain Service roles.
      Complete the installation procedure and configure the roles.

2.  Then, start to add Application Server and Web Server roles.
      This installation is straight forward, and you will be easily get your Application Server and Web Server roles configured in the machine.

3. Install SQL Server 2008 SP1 + CU KB970315
     Download SQL Server 2008 SP1 here: http://www.microsoft.com/downloads/details.aspx?familyid=66AB3DBB-BF3E-4F46-9559-CCC6A4F9DC19&displaylang=en
     Download CU KB970315 here: http://support.microsoft.com/kb/970315

And here is the tricky part, installing SPS2010

4.  Extract SPS2010 installer to a folder

 <spsinstaller.exe> /extract:e:\sps2010

That command will extract <spsinstaller.exe> to folder e:\sps2010. Replace <spsinstaller.exe> with your own distribution.

 

 

5. You will see that there is several sub-folder under Files folder in the extracted location. Each sub-folder represents different setup option. For example, SetupFarm contains configuration files for farm installation option etc.

6. Start the installation sequence by executing following command in the extracted location.

        Setup.exe /config Files\SetupFarm\config.xml
 

If you want to know other options, you can execute : setup.exe /? command.

7.  Remember you will not see following installation option, so just follow the dialog and wait untill installation completed.

And now everything is normal again,

8.  Next start the Configuration Wizard. (If you have been doing SharePoint 2007, it is just straight forward and as easy as it was).

 

 

 

9. And finally you can start configuring the other development tools.

Remember that the step 4-7 are only necessary when you install Active Directory Domain Service in a Single Box – otherwise you can always execute the installer directly.

Howto: Use lambda expression in SharePoint – Working with SPWeb

English

Before you continue reading this post, I hope you have read the basic task to start using lambda expression in SOM here.

A.  Find any Event list in site.

SPWeb spWeb = SPContext.Current.Web

var lists = spWeb.Lists.OfType<SPList>().Where(
             l => l.BaseTemplate == SPListTemplateType.Events);
  foreach (SPList list in lists)
{
       Console.WriteLine("{0} {1}", list.BaseTemplate.ToString(), list.Title);

  }

B.  Find any list based on custom list definition with Type=20080

SPWeb spWeb = SPContext.Current.Web

var lists = spWeb.Lists.OfType<SPList>().Where(
             l => (int) l.BaseTemplate == 20080);
  foreach (SPList list in lists)
{
       Console.WriteLine("{0} {1}", list.BaseTemplate.ToString(), list.Title);

  }

C. Find any “Daily” alert in the site

SPWeb spWeb = SPContext.Current.Web

var alerts = spWeb.Alerts.OfType<SPAlert>().Where(
                                  a => a.AlertFrequency == SPAlertFrequency.Daily);

  foreach (SPAler alert in alerts)
{
      // Do something with alert

  }

D.  Find any user which are Domain group

SPWeb spWeb = SPContext.Current.Web

var users = spWeb.SiteUsers.OfType<SPUser>().Where(
                              u => u.IsDomainGroup );

  foreach (SPUser user in users)
{
      // Do something with alert

  }

Howto: Configure personal regional setting

English

When you are working in multi-sites environment you may sometimes confused with the timestamp given by the server. The timestamp (Created Date, Modified Date) is combination of several factors :

a. Server TimeZone   , is physical server timezone configuration.
b. Web Application TimeZone , is application level timezone configuration.
c. Site   , is subsite, web timezone configuration.

How would you make sure that you are working on correct timezone in SharePoint? This post will explain how to configure personal regional settings.

1. Click on Logon User menu, and select My Settings
TZ_2

 

2. On the User Information page, click on “My Regional Settings”
TZ_3

 

3. On Regional Settings page, uncheck “Always follow web settings” and configure your personal Time zone setting and click OK.

TZ_4

4.Sample of same page with different time zone configuration

   Original view.
   Website timezone : GMT+7
   Webserver timezone : GMT+8
   Client timezone        : GMT+8

TZ_1 

 

   After configuring regional setting view.
   Website timezone : GMT+8
   Webserver timezone : GMT+8
   Client timezone        : GMT+8

   TZ_6

So, don’t be fooled by website timezone configuration.

Howto: Limits PageLayouts availability in Create Page

English

When you start to create a page, you will be presented a Create page form. In that page, you will have opportunity to select the page layouts for the new page. This howto will describe how to limits page layouts availability in create page. 

See picture below, instead of having all page  layouts listed – we only have 3 page layouts related to the site.

5-6-2009 10-54-32 AM

Howto:

1. Open Site Settings, and click on “Page layouts and site templates”

5-6-2009 10-43-43 AM

 

2. Select “Pages in this site can only use the following layouts:” and subsequently select the page layouts for current site.

5-6-2009 10-53-33 AM

3. Click “OK” to apply your changes.

Howto: Use lambda expression in SharePoint Object Model – Working with WebApplication

English

Before you continue reading this post, I hope you have read the basic task to start using lambda expression in SOM here.

A. Find existing job definition, named “Change Log”

SPWebApplication spWebApplication = SPContext.Current.Site.WebApplication;
var jobs = spWebApplication.JobDefinitions.Where(x => x.Title == "Change Log");
foreach(SPJobDefinition job in jobs)
               Console.WriteLine(job.Id);

B. Find existing custom job definition MyCustomJobDefinition, named “My Custom Job”

SPWebApplication spWebApplication = SPContext.Current.Site.WebApplication;
var jobs = spWebApplication.JobDefinitions.OfType<MyCustomJobDefinition>().Where(x => x.Title == "My Custom Job");
foreach(SPJobDefinition job in jobs)
               Console.WriteLine(job.Id);

C. Find site collection from “STS” template

SPWebApplication webApplication = SPContext.Current.Site.WebApplication;

var allSPSite = webApplication.Sites.OfType<SPSite>().Where(s => s.RootWeb.WebTemplate.Equals("STS", StringComparison.InvariantCultureIgnoreCase));

foreach(SPSite spSite in allSPSite)

{

      // operation in the SPSite

}

D. Find All RootWeb (of Site collection)

SPWebApplication spWebApplication = SPContext.Current.Site.webApplication;
var rootWebs= spWebApplication.Sites.OfType<SPSite>().Select ( s => s.RootWeb );
foreach (SPWeb spWeb in rootWebs)
{
   // Do your task here
}

E. Find if Site Collection with RootWeb contains list named “Sample List”

SPWebApplication spWebApplication = SPContext.Current.Site.webApplication;
var sites = spWebApplication.Sites.OfType<SPSite>().Where(
                    s => s.RootWeb.Lists.OfType<SPList>().Where(
                         l => l.Title.Equals("Sample List",StringComparison.InvariantCultureIgnoreCase)).Count() > 0);
foreach (SPSite spSite in sites)
{
   // Do your task here
}

F. Find if RootWeb which contains list named “Sample List”

SPWebApplication spWebApplication = SPContext.Current.Site.webApplication;

var rootWebs = spWebApplication.Sites.OfType<SPSite>().Select(s => s.RootWeb).Where(
                                 r => r.Lists.OfType<SPList>().Where(
                                     l => l.Title.Equals("Sample List",StringComparison.InvariantCultureIgnoreCase)).Count() > 0);

foreach (SPWeb spWeb in rootWebs)
{
   // Do your task here
}

Howto: Use lambda expression in SharePoint Object model

English

Lambda expression has been introduced since .NET framework 3.5, it is an anonymous function that can contain statement and expression. For more understanding on lambda expression you can read directly in MSDN page here. I will assume that you have read the topic and you can remember the lambda simply as:

(input parameters ) => operation

We will start with very basic operation of using lambda expression in SOM, and I hope you’ll find your path for more complex one. (note some code may not be efficient, for the clarity purpose)

A.  Start with OfType<TResult>() function to get IEnumerable that implement query pattern.

Example:

Originally to browse to all Site collection in WebApplication we will write,

SPWebApplication webApplication = SPContext.Current.Site.WebApplication;

SPSiteCollection allSPSite = webApplication.Sites;

foreach(SPSite spSite in allSPSite)

{

      // operation in the SPSite

}

the equivalent for our lambda starter is,

SPWebApplication webApplication = SPContext.Current.Site.WebApplication;

var allSPSite = webApplication.Sites.OfType<SPSite>();

foreach(SPSite spSite in allSPSite)

{

      // operation in the SPSite

}

B. Use lambda expression in the IEnumerable

Example :

You need to list all Site collection which uses STS site template.

Originally you will write,

SPWebApplication webApplication = SPContext.Current.Site.WebApplication;

SPSiteCollection allSPSite = webApplication.Sites;

foreach(SPSite spSite in allSPSite)

{

      if(spSite.RootWeb.WebTemplate.Equals(“STS”,StringComparison.InvariantCultureIgnoreCase))

     {

           // Do operation in selected site

     }

}

the equivalent using lambda is,

SPWebApplication webApplication = SPContext.Current.Site.WebApplication;

var allSPSite = webApplication.Sites.OfType<SPSite>().Where(s => s.RootWeb.WebTemplate.Equals("STS", StringComparison.InvariantCultureIgnoreCase));

foreach(SPSite spSite in allSPSite)

{

      // operation in the SPSite

}

Ok, now I believe you will get the idea of how to use lambda expression in SOM collection. In next posting, I’ll cover directly to the sample usage of the lambda.

Howto: Enable Debuging in SharePoint Web Application

English :

I know that people are already blogging this topic, but I just want to make summary of the procedure.

1. You need to modify 3 lines in web.config

2. The 3 lines are :

     a.  <SafeMode MaxControls="200" CallStack="true" DirectFileDependencies="10" TotalFileDependencies="50" AllowPageLevelTrace="false">

     b. <customErrors mode="Off" />

     c. <compilation batch="true" debug="true" >

 

Alternatively you can install “Debugger Feature” from codeplex. (http://www.codeplex.com/features)

Howto: Configure Alternate Access Mapping

English

Alternate Access Mapping (AAM) is alternate URL address defined to access the same SharePoint site. For example, if you have SharePoint site to serve internal and external users – then you will consider AAM. Using AAM – we can also define different authentication method to the incoming request. For example, internal user will use Windows Integrated Authentication – while external user will use Form Based Authentication.

How-to configure alternate access mapping?

1. Open “Central Administration”  web and click on “Operations” tab.
 CentralAdmin_Operation

 

2. In “Operations” page click on “Alternate access mappings” link.

CentralAdmin_Operation_AAM

 

3.  You will see list of existing URLs with existing AAM (if any). Click on “Show All” combo box to “Change Alternate Access Mapping Collection”

CentralAdmin_Operation_AAM_List

 

4.  Select the Web Application to which you want to modify the AAM.

CentralAdmin_Operation_AAM_Select 

5.  Click on “Add Internal URLs” to add new AAM ( or “Edit Public URLs’ to edit existing one).

CentralAdmin_Operation_AAM_Add

6.  Type in the URL protocol, host and port – as alternative address for your users. For example, http://extranet.someserver.com.

Select the zone for the URL, (Intranet, Internet, Custom, Extranet, Default).

Then, click “Save”

CentralAdmin_Operation_AAM_Add_Detail

7.  Now you can see new alternate URLs to access SharePoint site.

CentralAdmin_Operation_AAM_Add_Result

Happy configuring.

Howto: Disable MySite or My Links – link

English

This is graphical guidelines to disable MySite or My Links link in a portal.

 

A. Open Central Admin , and click on SSP which serve My Site.

d12

 

B. In the SSP Management page, click on “Personalization services permissions” d13

C. Select the users/group, and click “Modify Permission of Selected Users”
 d14

 

D.  To remove "My Site” links, uncheck “Create personal site” , and to remove “My Links” link, uncheck “Use personal features” , and click OK.
d15

E.  After you’ve saved the modification, the user will no longer see the links.
d16

Computers Business Directory - BTS Local