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:

[sourcecode language=”csharp”]

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

[/sourcecode]

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.

About Karsten Schneider 312 Articles
Consultant for Microsoft 365 Applications with a strong focus in Teams, SharePoint Online, OneDrive for Business as well as PowerPlatform with PowerApps, Flow and PowerBI. I provide Workshops for Governance & Security in Office 365 and Development of Solutions in the area of Collaboration and Teamwork based on Microsoft 365 and Azure Cloud Solutions. In his free time he tries to collect tipps and worthy experience in this blog.

Be the first to comment

Leave a Reply

Your email address will not be published.


*