SharePoint 2010: Howto start customize list form (New/Edit/View) using InfoPath Designer 2010

English

In SharePoint 2010 there we have more option to customize list form. For instance, you can use SharePoint Designer 2010 or InfoPath Designer 2010. Since modifying list form using SPD is already exist in previous version. I will just show you how to customize list form using InfoPath Designer 2010.

When customizing list form using InfoPath Designer 2010, you will get all form designer benefit. For example, you can define the field validation rules, parent-child relation etc. And bet what, the process is straight forward. In this very basic how-to, I will demonstrate how to start customize list form using InfoPath Designer 2010. I will create an Book List with “Title” – “Author” – “Status” column. In the New form, I will only show “Title” and “Author” – while in Edit form, “Title” and “Author” will be readonly, but “Status” is editable.

How to customize list form using InfoPath Designer 2010.

  1. Prepare the custom list.

    Prepare custom “Book List” with 3 columns: “Title” – “Author” – “Status”. “Status” field is choice “Available” – “In Used” – “Missing”. After creating the list and preparing columns, we can start to use the list and add a new item in this form.

  2. Start InfoPath Designer

    Start InfoPath Designer and select to design SharePoint List form.

    Type in the SharePoint site URL

    And then select the Book List from the list of available data.

    Finally, click on Finish.

  3. When the form editor open , you can start to edit the New form. I add a title “Book List Entry” and delete the “Status” row.

     

    And here is the result:

  4. Add “Edit Form” view in the designer, and set Title and Author as readonly.

     

    Type-in the view title.

    Design the form – add “Status” column in the form.

    Set “Title” and “Author” textbox property to “ReadOnly”

  5. Publish the form to the list.

     

  6. Configure the “Book List” to use designated form.

    Open the list setting page, and expand context menu for the Forms.

    Since the first view will be the default – our interest is only to the “(Item) Edit Form”. Click on (Item) Edit Form link, and change the Form view.

    You will realize that now you are seeing form services in web part.

    Click on Web Parts Tools tab, and then click on Web Part Properties.

    In the Web Part Properties, select the designated view.

  7. And here we go with the custom “New Form” and “Edit Form” for the list.

    New Form.

    Edit Form.

    Happy design

Tagged with: , ,
Posted in Howto, SharePoint 2010

Howto Series : Administration

English

I am trying to blog howto series on administration with graphical descriptions.

1. Howto configure personal regional settings.
2. Howto limits page layouts availability in web site.
3. Howto enable debuging in SharePoint Web Application.
4. Howto configure alternate access mapping.
5. Howto remove My Site or My Links link.

… and more are coming.

Posted in Office Server 2007, Tips and Tricks, Tools

Howto series : Lambda and SharePoint

English

I wrote some howto series for Lambda and SharePoint, you can find them here:

1. How to use lambda expression in SharePoint Object Model.
2. How to use lambda expression in SharePoint Object Model – working with WebApplication.
3. How to use lambda expression in SharePoint Object Model – working with SPWeb.

.. and more

Posted in Microsoft Sharepoint, Tips and Tricks

Moving to the new home

English

Begining the new Year 2009, I am moving this blog to the new home http://blog.libinuko.com. I’ll keep this location for references – and archives. I still use WordPress as blogging engine in the new home – but with entirely free ideas to put-in plugins, themes etc.

Thanks to WordPress.com which gaves me true blogging experience.

 

Bahasa

Mengawali tahun 2009, saya memindahkan blog ini ke tempat yang baru  http://blog.libinuko.com. Blog ini akan tetap ada sebagai referensi dan arsip.  

Terima kasih WordPress.com yang telah memberi pengalaman blogging selama ini.

Posted in General

Hyper V Installation using Microsoft Hyper-V and VMWare ESXI

English:

I just found a video comparing installation of Microsoft Hyper-V and VMWare ESXI.

Indonesian:

Ada yang mau mencoba Microsoft Hyper-V atau VMWare ESXI? Temukan caranya Hyper V side-by-side comparison.

 

Posted in General

Why Should We Use List and/or ID in Query String?

English (versi bahasa Indonesia)

One of my team asked me why should we use “List={GUID}” and/or “ID={ItemID}” in query string? Can’t we use other query string name?

My answer is yes you can use other query string name, but you will lost one of out of the box functionality. Why? Because when you keep with standar “List” or “ID” query string then you don’t need to parse it anymore – then SharePoint provides simple way to get SPList or SPListItem object using SPContext.

The query string  “List={GUID}” has corresponden SPContext.List , and query string “List={GUID}&ID={ItemID}” has the corresponden SPContext.Item. SPContext.List is SPList and SPContext.Item is SPListItem that can be obtained easily if you follow the convention.

So, check your code now. 

-o0o-

 

Indonesia (see English version)

Ada pertanyaan dari salah satu tim saya kenapa kita harus menggunakan “List={GUID}” dan/atau “ID={ItemID}” di dalam query string? dan apakah kita tidak boleh menggunakan nama lain untuk query string?

Jawabannya adalah tentu saja kita dapat menggunakan nama lain, tetapi kita akan kehilangan salah satu fungsi yang sudah disediakan oleh SharePoint. Mengapa?

Karena jika kita tetap menggunakan standar “List” atau “ID” didalam query string, maka kita tidak perlu melakukan parsing parameter lagi. Dan untuk itu SharePoint telah menyediakan cara yang sangat mudah untuk memperoleh object SPList atau SPListItem dengan menggunakan SPContext.

Query string  “List={GUID}” memungkinkan kita untuk memperoleh SPContext.List , dan query string “List={GUID}&ID={ItemID}” memungkinkan kita untuk memperoleh SPContext.Item. SPContext.List adalah objek SPList dan SPContext.Item adalah objek SPListItem yang dengan mudah diperoleh hanya jika kita mengikuti konvensi tersebut.

Jadi, coba cek lagi apakah sudah mengikuti konvensi yang berlaku?

Posted in Microsoft Sharepoint, Office 12, Office Server 2007, Tips and Tricks

What can cause “Error page has been modified”

English (versi bahasa Indonesia)

For anyone who customize SharePoint using SharePoint Designer, I believe you’ve familiar with “Error page has been modified”. The reason is obvious, you open the page in browser while modifying it using SharePoint Designer. Then save the page withing SharePoint Designer and try to access any links in that page. So, just go back , refresh and the link will works again.

PageRefreshIssue

But how about in a case that this happened in production environment, where nobody edit the page behind the screen. What can cause “Error page has been modified” ?

I have tried some resources from internet and check whether this can help me solve the problem:

1. One or more feature is missing (http://forums.technet.microsoft.com/en-US/sharepointgeneral/thread/9a98188b-9dec-4d85-b8b7-47ba41e5271f/)
2. Use of PublishingLayoutsPage instead of TemplateRedirectionPage (http://blogs.msdn.com/tejasr/archive/2008/06/19/resolution-moss-this-page-has-been-modified-since-you-opened-it-you-must-open-the-page-again.aspx)
3. Use of NLB with affinity set to none (http://support.microsoft.com/kb/892348)
4. Some says that security enhancement in MOSS SP1 (KB936984) /WSS SP1 (KB936988)help to fix this problem.

But unfortunatelly I come back with no luck, untill I read an article “The evil’s of RunWithElevatedPrivilege from Danniel Larson”. I believe that since it drops down to the thread identity, then the current session in page is no longer valid with the links. Thus creating exception “Error page has been modified”.  Then, I instructed my team to change all impersonation method to use

SPUserToken sysToken = SPContext.Current.Site.SystemAccount.UserToken;
using(var systemSite = new SPSite(SPContext.Current.Site.ID, sysToken))
{
    using (var sysWeb = systemSite.OpenWeb(SPContext.Current.Web.ID))
    {
        // Perform elevated actions here
    }
}

instead of using old

SPSecurity.RunWithElevatedPrivilege(delegate()
{
     using(var systemSite = new SPSite(SPContext.Current.Web.Url))
     {
           using (var sysWeb = systemSite.OpenWeb(SPContext.Current.Web.ID))
          {
               // Perform elevated actions here
          }

      }
});

 

That is and the production issues gone. So from now I would add one more entry to the list, Minimalize using RunWithElevatedPrivilege in your code, and use SPUserToken instead.

-o0o-

 

Indonesia (see English version)

Bagi rekan-rekan yang sering bekerja dengan SharePoint Designer, pesan kesalahan berikut ini pasti sering dijumpai “Error page has been modified”. Penyebabnya jelas sekali, karena kita membuka halaman di browser sementara di balik layar dilakukan editing dengan menggunakan SharePoint Designer. Kemudian setelah melakukan editing dan menyimpan halaman di SharePoint designer, kita langsung mengklik salah satu link di halaman yang telah dibuka. Cara mengatasinya cukup mudah , kembali ke halaman semula , refresh dan link-link akan bisa diakses seperti semula.

PageRefreshIssue

Tetapi bagaimana dengan kejadian yang muncul di server produksi? Di server produksi, tidak seorang pun mengedit halaman dengan SharePoint Designer. Jadi apa yang bisa menyebabkan “Error page has been modified” ?

Seperti biasa, saya mencari-cari informasi di internet dan menemukan beberapa hal dibawah yang mungkin dapat membantu:

1. Ada fitur yang ada di datastore tapi hilang secara fisik (http://forums.technet.microsoft.com/en-US/sharepointgeneral/thread/9a98188b-9dec-4d85-b8b7-47ba41e5271f/)
2. Tidak menggunakan TemplateRedirectionPage tapi PublishingLayoutsPage (http://blogs.msdn.com/tejasr/archive/2008/06/19/resolution-moss-this-page-has-been-modified-since-you-opened-it-you-must-open-the-page-again.aspx)
3. Menggunakan NLB dengan affinity diatur none (http://support.microsoft.com/kb/892348)
4. Beberapa mengatakan bahwa perbaikan prosedur keamanan di MOSS SP1 (KB936984) /WSS SP1 (KB936988) akan membantu menyelesaikan masalah.

Sayangnya semua hal diatas sudah terpenuhi, tetapi tetap saja masalah tersebut muncul. Sampai akhirnya saya membaca artikel tentang RunWithElevatedPrivilege – “The evil’s of RunWithElevatedPrivilege dari Danniel Larson”. Dari penjelasan yang ada, saya menduga bahwa penyebabnya adalah karena prosedur tersebut mengganti identitas thread dan menjalankan di thread lain, sehingga halaman yang sedang dibuka akan kehilangan “hubungan” dengan server (mirip dengan pada saat kita menyimpan dengan menggunakan SharePoint Designer). Akibatnya, link-link yang ada di halaman sudah tidak valid lagi dan muncul “Error page has been modified”. 
Berbekal dari dugaan itu, saya kemudian meminta rekan-rekan di team untuk mengganti cara impersonation untuk mengugnakan SPUserToken 

SPUserToken sysToken = SPContext.Current.Site.SystemAccount.UserToken;
using(var systemSite = new SPSite(SPContext.Current.Site.ID, sysToken))
{
    using (var sysWeb = systemSite.OpenWeb(SPContext.Current.Web.ID))
    {
        // Perform elevated actions here
    }
}

dan menghapus RunWithElevatedPrivilege

SPSecurity.RunWithElevatedPrivilege(delegate()
{
     using(var systemSite = new SPSite(SPContext.Current.Web.Url))
     {
           using (var sysWeb = systemSite.OpenWeb(SPContext.Current.Web.ID))
          {
               // Perform elevated actions here
          }

      }
});

 

Dan seperti yang diharapkan, masalah di production akhirnya teratasi. Jadi mulai dari saat ini saya akan menambahkan satu lagi di dalam daftar , Kurangi penggunaan RunWithElevatedPrivilege dan sedapat mungkin gunakan SPUserToken.  

Posted in Microsoft Sharepoint, Office 12, Office Server 2007, Tips and Tricks