I have the opposite problem - I am finding that, after customizing NewDocSet.aspx, I am no longer being redirected into the Doc Set after creation, and it's redirecting back to the parent library instead.
So I would suggest following the steps in the below post to get the behavior you want.
Customize NewDocSet.aspx form?
Edit: The behavior that occurs after you create a Document Set is controlled by the assemblies loaded by the form. The default form NewDocSet.aspx registers the following assembly: Microsoft.Office.DocumentManagement.Pages
, and inherits a set of methods from the class Microsoft.Office.DocumentManagement.Pages.NewDocSet
:
<%@ Assembly Name="Microsoft.Office.DocumentManagement.Pages, Version=16.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c"%>
...
<%@ Page Language="C#" DynamicMasterPageFile="~masterurl/default.master" Inherits="Microsoft.Office.DocumentManagement.Pages.NewDocSet"
This file (Microsoft.Office.DocumentManagement.Pages.dll
) is located on the Server at
C:\Program Files\Common Files\microsoft shared\Web Server Extensions\16\CONFIG\BIN\
One of the class methods for ~DocumentManagement.NewDocSet is OKBtn_Click
, which is referenced in NewDocSet.aspx by the "Save" button's onclick attribute:
<asp:button class="ms-ButtonHeightWidth" runat="server" text="<%$Resources:wss,multipages_savebutton_text%>" onclick="OKBtn_Click" id="btnOK" />
The OkBtn_Click
method handles creation of the Document Set, passing off control to other methods to validate, etc. At the very end of the method, there is code that redirects the user to the Welcome Page of the newly created Document Set (retrieved using ILSpy):
string a = base.Request.QueryString["Sync"];
if (a == "1")
{
using (SPLongOperation sPLongOperation = new SPLongOperation(this))
{
sPLongOperation.Begin();
DocumentSet documentSet = DocumentSet.Create(parentFolder, name, ctid, properties, bProvisionDefaultContent: true, (SPUser)null, (SPLongOperationState)null);
string welcomePageUrl = documentSet.WelcomePageUrl;
if (base.IsDialogMode)
{
sPLongOperation.EndScript("window.frameElement.navigateParent('" + SPHttpUtility.EcmaScriptStringLiteralEncode(welcomePageUrl) + "');");
}
sPLongOperation.End(welcomePageUrl, SPRedirectFlags.Default, Context, null);
}
}
else
{
SPStatefulLongOperation.Begin("", DocumentSet.ProgressHtml, delegate(SPStatefulLongOperation longOperation)
{
DocumentSet docset = null;
longOperation.Run(delegate(SPLongOperationState longOperationState)
{
docset = DocumentSet.Create(parentFolder, name, ctid, properties, bProvisionDefaultContent: true, (SPUser)null, longOperationState);
});
string welcomePageUrl2 = docset.WelcomePageUrl;
if (base.IsDialogMode)
{
longOperation.EndScript("window.frameElement.navigateParent('" + SPHttpUtility.EcmaScriptStringLiteralEncode(welcomePageUrl2) + "');");
}
longOperation.End(welcomePageUrl2, SPRedirectFlags.Default, Context, null);
});
}
What this appears to show is that the method used by the "Save" button is what makes the difference. Hence in my case, where I am using a "custom" Document Set New Form based on a generic List New Form, the OKBtn_Click
method is never called and hence the redirection logic is different.
Kudos to this blog post for helping me to figure out the above.