Ideas for Free

Ideas for Free

only freedom gives SharePoint real power to grow

Ideas for Free RSS Feed
 

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
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
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
SPBag3

And voila, I have saved you from big trouble.

Microsoft SharePoint Administration Toolkit the 4th

English

Today, I almost missed an update of very nice tool – Microsoft SharePoint Administration Toolkit. I browse to Microsoft SharePoint Team Blog, – found out that they already announce the 4th release last week.

But before you can play around with the tools, you will need to install following pre-requisites:

  1. Service Pack 2 for WSS and SharePoint Server 2007
  2. April Cumulative Update for WSS and SharePoint 2007.

The April CU comes as hotfix – so you will need to register your email address and get the download link + password from your inbox.

Since its almost late for me, I think – I will continue the installation tomorrow, after downloading the package.

Check here for more details :
1. April CU : http://blogs.msdn.com/sharepoint/archive/2009/05/13/april-cumulative-update-packages-ready-for-download.aspx

2. Microsoft SharePoint Administration toolkit:
http://blogs.msdn.com/sharepoint/archive/2009/08/27/announcing-the-fourth-release-of-the-microsoft-sharepoint-administration-toolkit.aspx

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
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
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
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.

Windows Live Writer

Setelah lama menggunakan BlogJet, hari ini nampaknya saya akan beralih menggunakan Windows Live Writer. Yach, kita harus menghormati pembuat BlogJet yang menuntut pembayaran lisensi; sementara menulis di Blog adalah pekerjaan sambilan yang semestinya juga gratis. Jadi tidak logis kalau saya harus merogoh kocek untuk membeli BlogJet.

Dilain pihak, Microsoft menawarkan Windows Live Writer secara gratis kepada para pengguna Windows. Jadi mungkin ini adalah saat yang tepat untuk berpindah kelain hati. Goodby BlogJet, and welcome Windows Live Writer.

Pertama saya pikir, Windows Live Writer tidak secantik ini. Ternyata WLW ini memberikan pengalaman menulis blog yang kaya. Saya seolah-olah menulis langsung di halaman blog.

image
image

Bagian preview pun tak kalah menariknya, karena menampilkan preview tampilan blog kita secara utuh dengan themes yang digunakan. Nampaknya, saya akan segera jatuh cinta pada Windows Live Writer.

Misalnya, ketika saya mengganti account blog ke blog yang lain, WLW secara otomatis akan mendownload themes dan file-file yang dibutuhkan untuk menampilkan perview. Dan hasilnya saya memang seolah-olah melihat tampilan posting di web.

image
image

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

  }

Computers Business Directory - BTS Local