SPListItem listItem = SPList.GetItemById(itemID); // New form full url string newFormFullUrl = string.Format("{0}{1}?ID={2}", listItem.Web.Url, listItem.ParentList.Forms[PAGETYPE.PAGE_NEWFORM].ServerRelativeUrl, listItem.ID); // Edit form full url string editFormFullUrl = string.Format("{0}{1}?ID={2}", listItem.Web.Url, listItem.ParentList.Forms[PAGETYPE.PAGE_EDITFORM].ServerRelativeUrl, listItem.ID); // Display form full url string displayFormFullUrl = string.Format("{0}{1}?ID={2}", listItem.Web.Url, listItem.ParentList.Forms[PAGETYPE.PAGE_DISPLAYFORM].ServerRelativeUrl, listItem.ID); //Relative Url string newFormRelativeUrl = string.Format("{0}?ID={1}", listItem.ParentList.Forms[PAGETYPE.PAGE_NEWFORM].ServerRelativeUrl, listItem.ID);
Tuesday, August 9, 2011
SharePoint ListItem New, Edit and Display forms Dynamic URLs
Getting the SharePoint List Item form URLs(New, Edit ad Display) dynamically respect to the context instead of hard-coding.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment