You want to get the listform url of an item?

This post will be a smaller one, but maybe it helps you some day. In a customer project we had to send mails if an item has reached a defined status. In that mail the user should get an link to the item edit form, that he has not to search for the mentioned item. Therefore we provided a link to the item itself and its edit form. We used therefore this script:



string.Format("{0}/{1}?ID={2}", item.Web.Url, item.ParentList.Forms[PAGETYPE.PAGE_EDITFORM].Url, item.ID);
PAGETYPE.PAGE_DISPLAYFORM


It puts together 3 item properties:

item.Web.Url = http://yourserver/sites/yoursite

item.ParentList.Forms[PAGETYPE.PAGE_EDITFORM].Url = Lists/Editform.aspx

item.ID = the ID of the item

Therefore we put it into the string. That’s it. The same can be done with new form and display form – you just have to change the pagetype.

..:: I LIKE SHAREPOINT ::..

The article or information provided here represents completely my own personal view & thought. It is recommended to test the content or scripts of the site in the lab, before making use in the production environment & use it completely at your own risk. The articles, scripts, suggestions or tricks published on the site are provided AS-IS with no warranties or guarantees and confers no rights.

Karsten Pohnke About Karsten Pohnke
He is Consultant for SharePoint Solutions for collaboration, communication and business processes. He provides his customers applications based on standard features as well as development or combining the power of several microsoft tools like Dynamics CRM. In his free time he tries to collect tipps and worthy experience in this blog.

Submit comment

Allowed HTML tags: <a href="http://google.com">google</a> <strong>bold</strong> <em>emphasized</em> <code>code</code> <blockquote>
quote
</blockquote>

Please fill in the captcha: * Time limit is exhausted. Please reload CAPTCHA.