@@ -45,6 +45,25 @@ public static string SendEnvelopeUsingEmbeddedSending(string signerEmail, string
4545 // Step 3. create the sender view
4646 // Call the CreateSenderView API
4747 // Exceptions will be caught by the calling function
48+ EnvelopeViewRequest viewRequest = PrepareViewRequest ( startingView , returnUrl ) ;
49+
50+ ViewUrl result1 = envelopesApi . CreateSenderView ( accountId , envelopeId , viewRequest ) ;
51+
52+ // Switch to Recipient and Documents view if requested by the user
53+ string redirectUrl = result1 . Url ;
54+ Console . WriteLine ( "startingView: " + startingView ) ;
55+ if ( "recipient" . Equals ( startingView ) )
56+ {
57+ redirectUrl = redirectUrl . Replace ( "send=1" , "send=0" ) ;
58+ }
59+
60+ //ds-snippet-end:eSign11Step3
61+
62+ return redirectUrl ;
63+ }
64+
65+ private static EnvelopeViewRequest PrepareViewRequest ( string startingView , string returnUrl )
66+ {
4867 EnvelopeViewSettings viewSettings = new EnvelopeViewSettings
4968 {
5069 StartingScreen = startingView ,
@@ -82,20 +101,7 @@ public static string SendEnvelopeUsingEmbeddedSending(string signerEmail, string
82101 ViewAccess = "envelope" ,
83102 Settings = viewSettings ,
84103 } ;
85-
86- ViewUrl result1 = envelopesApi . CreateSenderView ( accountId , envelopeId , viewRequest ) ;
87-
88- // Switch to Recipient and Documents view if requested by the user
89- string redirectUrl = result1 . Url ;
90- Console . WriteLine ( "startingView: " + startingView ) ;
91- if ( "recipient" . Equals ( startingView ) )
92- {
93- redirectUrl = redirectUrl . Replace ( "send=1" , "send=0" ) ;
94- }
95-
96- //ds-snippet-end:eSign11Step3
97-
98- return redirectUrl ;
104+ return viewRequest ;
99105 }
100106
101107 //ds-snippet-start:eSign11Step2
0 commit comments