Ideas for Free

Ideas for Free

only freedom gives SharePoint real power to grow

Ideas for Free RSS Feed
 

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
TZ_2

 

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

TZ_3
TZ_3

 

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

TZ_4
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
TZ_1
 

 

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

  

TZ_6
TZ_6

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

Configuring web.config for RSS WebParts

English

Today, I’ve got an enquiries from one of our users, who could not configure their RSS WebParts. I know from the errors message, its related with proxy and authentication – but in fact he was trying to get feed from internal server.

So, what is the situation?
We have internal domain with suffix *.mib , however some of our internal server doesn’t have internal name or lies across the region. Those which lay on the other region are only accessible through *.com name, which then routed using VPN in our internal network.

Existing web.config, is a standard just like in Kit Kai blog, or Agusto blog.

Suspect
a. Authentication
    All of our servers uses requires user authentication, which normally integrated into their domain account. However, when we deal with this kind of scenario, we may expect double-hop situation. Where users authentication need to be proxy to the next  server. In our environment, we identified that this is not a problem since they all configured with KERBEROS.

b. Incorrect route
    We know that the purpose of bypassing local proxy is to avoid RSS feed request to be routed through proxy. Having request through proxy could be cumbersome, since RSS webpart should handle authentication which is unsupported.
Hmm..  this could be the problem. Since the source RSS on other region is having *.com address; so in this case “bypassonlocal=true” doesn’t give any benefit. 

The Fix
Fortunately there is one more section that we might overlooked. If we refer to MSDN in this link, we can specifically exclude any URLs from being proxied.

So, since I want exclude some internal *.mycompany.com from the proxy – I then modify the web.config into,

<configuration>
   <system.net>
      <defaultProxy>
         <proxy proxyaddress="
http://proxysvr.mib:8080" bypassonlocal="true" />
         <bypasslist>
            <add address="[a-z]+\.mycompany\.com" />
            <add address="192\.168\..*" />
         </bypasslist>
      </defaultProxy>
   </system.net>
</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
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
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
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.

Critics to SharePoint resource deployment “stsadm –o copyappbincontent”

English

When you start to work with localization in SharePoint, I believe that you may end with one of Mikhail Dikov proposal here or here .

Partially I agree with his proposal, to leverage the resource deployment through the UI. However, his strategy may fail when you apply to server farm architecture with multiple Web Front End (WFE).

You have to go to every WFE, and activate/deactivate the feature before you can get it deployed in all WFE. The same concept as standard SharePoint’s stsadm command,

stsadm –o copyappbincontent

That command, instruct local SharePoint server to copy resources, sitemap etc. to web all application folder, except the Central Admin webapps.

And still we have big problem, that we have to run that command in every WFE.

I can say this is a big problem, because it against the concept of centralized deployment of WSP. Imagine, if you’re system administrator who wants to have WSP to automate distribution of artifact – and now you are facing a fact that since the WSP contains resources; you don’t have the centralized deployment concept anymore.
After doing

stsadm –o addsolution

stsadm –o deploysolution

in one of WFE – then you have to go through all WFE to execute

stsadm –o copyappbincontent

to deploy resources to webapps.

I know that some system administrator / production team, so we have to solve this problem. May be change it to stsadm –o copyfarmappbincontent , to perform appbincontent deployment in farm architecture. 

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)

SSP: How to add new profile property mapping

English

When you work with Microsoft Office SharePoint Server (MOSS 2007), you’ll find that one of its component is User Profiles synchronization. The User Profiles synchronization is maintained by Shared Service Provider (SSP). It synchronized MOSS user profile with Active Directory profiles.

There are around 46 predefined profile with 21 are mapped to AD property.

Some of you might have an idea that you can add the new profile or change how it mapped to AD property. But how would you do it? Its not complex task, but I would like to make it graphical how-to.

1. Open SSP Administration page and click on User profiles and properties.

5-5-2009 10-52-26 AM
5-5-2009 10-52-26 AM

 

2. On “User profiles and properties” page, click on “Add profile property”

 

5-5-2009 10-53-23 AM
5-5-2009 10-53-23 AM

3. On “Add user profile property” page, define the new profile. I put yellow mark on the important things,

- Name              : Fieldname for new profile property

- Display Name   : Display name for new profile property

- Type               : Field type

- Source Data Connection : Profile property mapping definition

5-5-2009 10-55-14 AM
5-5-2009 10-55-14 AM

4. Finally, after you define the mapping in “Source Data Connection” you can click OK. Do full import to update current profiles with the new profile property.

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
CentralAdmin_Operation

 

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

CentralAdmin_Operation_AAM
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
CentralAdmin_Operation_AAM_List

 

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

CentralAdmin_Operation_AAM_Select
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
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
CentralAdmin_Operation_AAM_Add_Detail

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

CentralAdmin_Operation_AAM_Add_Result
CentralAdmin_Operation_AAM_Add_Result

Happy configuring.

Jumpstart to InfoPath Development

English

Today I gave my session about InfoPath Development.  In this session I show how InfoPath form to capture information and use the data for further processing. Begins with introductions to InfoPath form and InfoPath Form Services, up to several deployment procedure of the form to the server.

When we design an InfoPath form template, we essentially define Data Structure and Layouts – plus some business logic or manage code.  Once the form template is ready – then it need to be accessible by target users. Thus  comes the publishing task.

Publishing task is an action to make the InfoPath form template available to target users – for example through email, network shared, installable template, or SharePoint form library. The last method involves SharePoint to store the template. And even more, Microsoft Office SharePoint Server 2007 provides InfoPath Form Services to enable web-page rendering of an InfoPath form – eleminating requirement to install InfoPath application in the client. Clients only need a web browser to open and fill-up the form.

Field promotion in InfoPath enables us to expose InfoPath template data source to SharePoint form library. The field can be promoted as read-only column or read-write column. If you enable read-write during the promotion, then you can use SharePoint Object Model to write data to that column – that will be reflected in the form.

I just only have 1.5 hours for the talks, so here is the presentation slide and screencast of the demo. [pro-player width='530' height='330' type='MP4']http://www.fileden.com/files/2009/2/18/2327167/JumpStartToInfoPathDevelopmentScreenCast.mp4[/pro-player]

Computers Business Directory - BTS Local