Home > Development, SharePoint > Example of how to get the URL to SharePoint 2007 Form Pages

Example of how to get the URL to SharePoint 2007 Form Pages

You can use the following syntax to get the fully qualified URL to a Form for a SharePoint List / Library.

SPList list = SPContext.Current.List;

SPListItem item = list[0];

item.Web.Url + "/" + item.ParentList.Forms[PAGETYPE.PAGE_DISPLAYFORM].Url + "?ID=" + item.ID

 

PAGETYPE is an enumeration of the SharePoint Forms:

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.

  1. No comments yet.
  1. No trackbacks yet.