When you click “New Item” in any SharePoint list or “Upload” in any document library, SharePoint sends you to a standard form for creating the new item. Behind the scenes, SharePoint also passes in two parameters to let the form know where to post the item and where to go after the item is posted. By leveraging these two parameters in the URL, you can make a link anywhere that posts data to any list and sends you someplace else when finished. This has come in handy for us when creating intranet home pages, as we can create a list of links to post data to custom lists, which sends the person back to the home page afterwards. Otherwise, the person would end up in the root of the list or library they submitted the item to. So we were able to easily meet a requirement that the person be directed back to the home page after submitting the item.
A SharePoint new item link is structured as follows:
The two parameters of interest are RootFolder and Source. RootFolder tells SharePoint where to post the document. If it is removed from the URL then SharePoint will post data to the root of the list where newform.aspx is located. You could also specify the path to a subfolder there, and SharePoint would post to that subfolder. Source tells SharePoint where to go when the posting is complete. The source needs to be a place in the site collection. In the example link above it is back to the home page. If source is left out of the URL then SharePoint will just return you back to the root of the list afterwards.
This is big with DVWPs. I have several DVWP with HTML Form filters on them. The DVWP document library form doesn’t allow a new item unfortunately, so I can instead make a link to the upload.aspx of that document library, and after changes are complete, SharePoint sends the user right back to where they clicked that link.
A DVWP upload form would be nice. Does anyone know what Microsoft is doing about DVWP and document libraries? I wonder if SharePoint 2013 will be more integrated and more options through SP Designer.