The URL attribute of splistitem does not return an absolute path. The format is shown below:
Http: // Cary/lists/discussion/itemtitle
This form cannot be opened as a link. In many cases, when we get this item, we also need to get the URL of this item, for example, when you filter the specified data in the column table and send an email to relevant personnel, you need a link to this item in the email content.
A pagetype enumeration is provided in Moss, as shown in the following table:
| Name |
Description |
| Page_defaultview |
Default view. value = 0. |
| Page_dialogview |
File Dialog Box view. value = 2. |
| Page_displayform |
Display form for list items. value = 4. |
| Page_displayformdialog |
Display form for a file dialog box. value = 5. |
| Page_editform |
Edit form for list items. value = 6. |
| Page_editformdialog |
Edit form for a file dialog box. value = 7. |
| Page_invalid |
Not used. value =-1. |
| Page_maxitems |
Not used. value = 11. |
| Page_newform |
New Form for list items. value = 8. |
| Page_newformdialog |
New form for a file dialog box. value = 9. |
| Page_normalview |
Normal view. value = 1. |
| Page_solutionform |
Solution form. value = 10. |
| Page_view |
View, including both default view and normal view. value = 3. |
We can use the followingCodeTo get the link of the item:
Splist list = site. Lists. getlist ("/lists/discussion ");
Splistitem item = List. items [ID];
String strurl = List. Forms [pagetype. page_displayform]. url + "? Id = "+ item. ID
You can obtain the following link:
Http: // Cary/lists/discussion/dispform. aspx? Id = 680
This can be opened as a link.