@@ -70,8 +70,7 @@ static void Main(string[] args)
70
70
}
71
71
72
72
// API Call
73
- string result = "" ;
74
- options . Username = options . Username + "@" + options . Tenant ;
73
+ string result = "" ;
75
74
restUrl = cloudRepoUrl . Replace ( "{host}" , host ) + cloudCollection ;
76
75
soapUrl = soapUrl . Replace ( "{tenant}" , options . Tenant ) . Replace ( "{version}" , "v37.0" ) ;
77
76
@@ -94,26 +93,29 @@ static void Main(string[] args)
94
93
case Command . CLAR_UPLOAD :
95
94
bytes = File . ReadAllBytes ( file ) ;
96
95
Console . WriteLine ( "\n \n Deploying the CLAR and awaiting the result...\n \n " ) ;
97
- result = WDWebService . CallRest ( options . Tenant , options . Username , options . Password , restUrl , "PUT" , bytes ) ;
96
+ result = WDWebService . CallRest ( options . Tenant , options . Username + "@" + options . Tenant , options . Password , restUrl , "PUT" , bytes ) ;
98
97
break ;
99
98
case Command . DRIVE_UPLOAD :
100
99
bytes = File . ReadAllBytes ( file ) ;
101
- result = DriveUpload ( file , bytes , soapUrl ) ;
100
+ result = DriveUpload ( file , bytes , soapUrl , options . Username ) ;
102
101
break ;
103
102
case Command . DRIVE_TRASH :
104
- result = DriveTrash ( file , soapUrl ) ;
103
+ result = DriveTrash ( file , soapUrl , options . Username ) ;
105
104
break ;
106
105
}
107
106
108
- if ( result . IndexOf ( "<?xml" ) < 0 && result . IndexOf ( "<SOAP " ) < 0 )
107
+ if ( result . ToLower ( ) . IndexOf ( "<html " ) >= 0 )
109
108
{
110
109
Console . WriteLine ( "No XML response detected. Workday may be unavailable or your parameters are incorrect." ) ;
111
110
}
112
111
else
113
112
{
114
- Console . WriteLine ( "Result for " + file + "\n " ) ;
115
- Console . WriteLine ( result ) ;
116
- Console . WriteLine ( "\n \n " ) ;
113
+ if ( ! String . IsNullOrEmpty ( result ) )
114
+ {
115
+ Console . WriteLine ( "Result for " + file + "\n " ) ;
116
+ Console . WriteLine ( result ) ;
117
+ Console . WriteLine ( "\n \n " ) ;
118
+ }
117
119
}
118
120
}
119
121
}
@@ -436,7 +438,7 @@ static string SoapUrlBuild()
436
438
return soapUrl ;
437
439
}
438
440
439
- static string DriveUpload ( string file , byte [ ] bytes , string soapUrl )
441
+ static string DriveUpload ( string file , byte [ ] bytes , string soapUrl , string uploadedBy )
440
442
{
441
443
string result = "" ;
442
444
try
@@ -445,8 +447,8 @@ static string DriveUpload(string file, byte[] bytes, string soapUrl)
445
447
{
446
448
Console . WriteLine ( "\n \n Uploading " + file + " to Drive and awaiting the result...\n \n " ) ;
447
449
string fileContents = Convert . ToBase64String ( bytes ) ;
448
- string xmlData = DriveApi . BuildSoapRequest ( file , fileContents , false ) ;
449
- result = WDWebService . CallAPI ( options . Username , options . Password , soapUrl , xmlData ) ;
450
+ string xmlData = DriveApi . BuildSoapRequest ( file , fileContents , uploadedBy , false ) ;
451
+ result = WDWebService . CallAPI ( options . Username + "@" + options . Tenant , options . Password , soapUrl , xmlData ) ;
450
452
if ( result . IndexOf ( "<?xml" ) == 0 )
451
453
{
452
454
string processedFile = Path . Combine ( processedDir , Path . GetFileName ( file ) ) ;
@@ -469,16 +471,16 @@ static string DriveUpload(string file, byte[] bytes, string soapUrl)
469
471
return result ;
470
472
}
471
473
472
- static string DriveTrash ( string file , string soapUrl )
474
+ static string DriveTrash ( string file , string soapUrl , string uploadedBy )
473
475
{
474
476
string result = "" ;
475
477
try
476
478
{
477
479
if ( file . Trim ( ) . Length > 0 )
478
480
{
479
481
Console . WriteLine ( "\n \n Trashing " + file + " in Drive and awaiting the result...\n \n " ) ;
480
- string xmlData = DriveApi . BuildSoapRequest ( file , "" , true ) ;
481
- result = WDWebService . CallAPI ( options . Username , options . Password , soapUrl , xmlData ) ;
482
+ string xmlData = DriveApi . BuildSoapRequest ( file , "" , uploadedBy , true ) ;
483
+ result = WDWebService . CallAPI ( options . Username + "@" + options . Tenant , options . Password , soapUrl , xmlData ) ;
482
484
}
483
485
}
484
486
catch ( Exception ex )
0 commit comments