Ideas for Free

Ideas for Free

only freedom gives SharePoint real power to grow

Ideas for Free RSS Feed
 

Archive for Microsoft Sharepoint

Troubleshoot: SPPropertyBag can not deserialize complex type.

 

English:

In SharePoint, there is SPPropertyBag which can stores arbitrary key-and-value pairs into configuration database. And this is very good location compared with web.config. Moreover we can also create our custom class from SPPersistedObject to persist it state in a permanent store and retrieve it for later usage. (see MSDN refence SPPersistedObject)

But don’t be so happy – the SPPropertyBag can only store primitive types such as strings, integers, and GUID; and collection of above. The main keyword to understand is SPPropertyBag can only store primitives type and not arbitrary key-and-value pairs.

When you try to store complex object, you’ll unstablize configuration DB. And most of the time, you will not be able to install WSP, or perform anything related with SPPropertyBag operation. For example the timer job will stops to work, any component that reads SPPropertyBag will suddenly stuck. All because SharePoint will try to retrieve any persisted object from configuration DB and it fails. It will then show you and error message like this,

The platform does not know how to deserialize an object of type [TYPE]. The platform can deserialize primitive types such as strings, integers and GUID; other SPPersistedObjects or SPAutoserializingObjects or collections of any of the above. (..more..)

The visual error will be something like this,

SPBag1

 

So how to troubleshoot this issue?

IMPORTANT! 
1. Please backup configuration DB before proceeding with following procedure.
2. This procedure will modify configuration DB directly , and is un-supported by Microsoft.

TROUBLESHOOT.

1. Remove offending assembly from GAC (C:\Windows\Assembly) store.

2. Open Query Manager in SQL Management Studio, and connect to SharePoint content DB. Check that you have all reference to the offending property bag.

SPBag2

3.  Offending property bag can be found in “Properties” field of Objects table. If you dig into the content you will find something like

<object type=……>
…<fld type=”[YOUR TYPE]”></fld>..
</object>

where [YOUR TYPE] is the one causing problem. Once you have sure that you have all rows selected, then you can do clean up.

4. Replace SELECT [Fields] statement with DELETE statement.

SPBag3

And voila, I have saved you from big trouble.

StsAdm –o copyfarmappbincontent is available in CodePlex

English

Remember about critics to “stsadm –o copyappbincontent” to deploy SharePoint resource in my previous post here.

At the end of the post, I think that it should be “stsadm –o copyfarmappbincontent” instead.

Why?
Because the last will work in centralized deployment mode, same as solution deployment.

But what’s the secret? Why the standard copyappbincontent doesn’t work in farm configuration?

I’ll post in another article. But now, I have created the project in Codeplex. You can grab the code or download the binary here.

SPD: How to change 24hr format to 12hr format AM/PM

English

I’ve found this question in forum – but since it was not easy to explain by sentences, I would like to create a sample working option here.

For example you have this list as data source:

9-4-2009 7-30-07 AM

In the data source you have 24hr format (I use string type for my sample, but you can use normal DateTime).

In SharePoint, to display the 24hr format in 12hr format, you need to use DataFormWebpart + proper ddwrt function like this:

9-4-2009 7-58-28 AM

The ddwrt function you need to play is:

ddwrt:FormatDate(string([Field]),1033,5)

[Field] is the field where you have the data, in this case internal name of “24hr format”.
1033 is the culture
5 is the predefined format , you can use ‘M/d/yyyy hh:mm:ss tt’ instead.

 

And the final result will be,

9-4-2009 8-02-18 AM

 

Happy design!

Semantic URLs for SharePoint

English

First time I understand about semantic URL is when I started to create my blog. According to the Wikipedia, ”Semantic URL” refers to a URL which is of a form that is immediately and intuitively meaningful to non-expert. For example,  if we refer to a publishing pages in SharePoint , we might see http://<someserver>/<somedepartment>/pages/default.aspx , or http://www.mycompany.com/hrdepartment/pages/policy.aspx which are not intuitive.

To make it easier for non SharePoint expert, one would love to remember semantic urls such as http://www.mycompany.com/hrdepartment/policy which then redirect to actual page under pages library in SharePoint.

Waldek has post excellent how-to , to create semantic URL in IIS-7 in his blog here. However, I wonder if we could do the same (without create single line of code) in IIS-6.

SharePoint Conference 2009

English

I never aware of SharePoint Conference before, but this year there will be SharePoint Conference 2009 with almost 250 sessions planned. And I hope we can get closer to know SharePoint 2010.

Taken from MS SharePoint Team blog, here are the sessions….

  • SharePoint 2010 Overview and What’s New
  • Upgrading to SharePoint 2010
  • SharePoint 2010 Capacity and Performance Planning
  • SharePoint 2010 Security and Identity Management: What’s New.
  • Visual Studio 2010 Tools for Office Development
  • SharePoint 2010 Ribbon, ECMAScript and Dialog Framework Development
  • Developing with REST and LINQ in SharePoint 2010
  • Upgrading SharePoint Server 2007 Code to SharePoint 2010
  • Building SharePoint Composite Applications with the Microsoft Application Platform
  • What’s New in Business Connectivity Services (The Business Data Catalog Evolves!)
  • FAST Search for SharePoint – Capabilities Deep-Dive
  • Advanced Dashboard Creation with PerformancePoint Services for SharePoint 2010
  • Overview of Visio 2010 and Visio Services for SharePoint 2010
  • SharePoint 2010 Web Content Management Deep-Dive
  • If You Build It, They Will Come: Driving End User Adoption

I wish I could come to the conference.

 

Indonesian

Sejak mengenal SharePoint, saya tidak pernah tahu akan adanya SharePoint Conference; namun di tahun 2009 ini akan diselenggarakan SharePoint Conference dengan menampilkan sekitar 250 sesi. Melihat sesi-sesi yang akan ditampilkan, nampaknya SharePoint Conference 2009 ini akan memperkenalkan SharePoint 2010 kepada masyarakat umum.

Berikut ini adalah rancangan sesi yang akan tampil di konferensi, diambil dari blog MS SharePoint Team….

  • SharePoint 2010 Overview and What’s New
  • Upgrading to SharePoint 2010
  • SharePoint 2010 Capacity and Performance Planning
  • SharePoint 2010 Security and Identity Management: What’s New.
  • Visual Studio 2010 Tools for Office Development
  • SharePoint 2010 Ribbon, ECMAScript and Dialog Framework Development
  • Developing with REST and LINQ in SharePoint 2010
  • Upgrading SharePoint Server 2007 Code to SharePoint 2010
  • Building SharePoint Composite Applications with the Microsoft Application Platform
  • What’s New in Business Connectivity Services (The Business Data Catalog Evolves!)
  • FAST Search for SharePoint – Capabilities Deep-Dive
  • Advanced Dashboard Creation with PerformancePoint Services for SharePoint 2010
  • Overview of Visio 2010 and Visio Services for SharePoint 2010
  • SharePoint 2010 Web Content Management Deep-Dive
  • If You Build It, They Will Come: Driving End User Adoption

I wish I could come to the conference.

Office 2010 Technical Preview

English

Wow the wave of Office 2010 is going closer and closer.  After the announcement of limited invitation to Office 2010 Technical preview , thus who does not have a good luck could browse to watch introduction video here.

Problem when installing WSP in Windows 7/Windows Server 2008

English

I know that Microsoft has fabulous 40, a collection of 40 site templates in this link. I have played with all the templates, without any problem – but today when I tried to install it in my Windows 2008 server I was stuck in the wsp deployment. It seems that I couldn’t deploy the WSP.

Then, I remembered that Windows 2008 has increased security model which prevent accidental execution using privileged account. So, what I did to solve it – was just simply open the cmd console using privileged account.

Right click on “cmd.exe” and select “Run as Administrator”. And here we go, all wsp finally deployed to my MOSS installation.

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.

Computers Business Directory - BTS Local