Ravi Babu Oruganti Posted June 27, 2021 Share Posted June 27, 2021 Dear Team, We are getting the below error message when we are using the citrix sharefile API service from application. kindly advise and do the needful on this issue. System.UriFormatException was unhandled HResult=-2146233033 Message=Invalid URI: The URI is empty. Source=System StackTrace: at System.Uri.CreateThis(String uri, Boolean dontEscape, UriKind uriKind) at System.Uri..ctor(String uriString) at ShareFile.Api.Client.ShareFileClient..ctor(String baseUri, Configuration configuration) at ShareFile.ShareFileService.PasswordAuthentication() in D:\Netways\alezeik\Api\ShareFile\ShareFile\ShareFileService.cs:line 79 at ShareFile.ShareFileService.Login() in D:\Netways\alezeik\Api\ShareFile\ShareFile\ShareFileService.cs:line 21 at ShareFile.Program.Main(String[] args) in D:\Netways\alezeik\Api\ShareFile\ShareFile\Program.cs:line 14 at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args) at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args) at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() at System.Threading.ThreadHelper.ThreadStart_Context(Object state) at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.ThreadHelper.ThreadStart() --------------- Link to comment
0 Preetham M R Posted June 29, 2021 Share Posted June 29, 2021 Hi, Looks like you are passing an empty/null string when creating an object of ShareFile.Api.Client.ShareFileClient class. Can you please send the appropriate base Uri and try? Accepted values for BaseUri are "https://secure.sf-api.com/sf/v3/", "https://secure.sf-api.eu/sf/v3/", "https://<YourSubdomain>.sf-api.com/sf/v3/", "https://<YourSubdomain>.sf-api.eu/sf/v3/" Thanks! Link to comment
0 Ravi Babu Oruganti Posted July 14, 2021 Author Share Posted July 14, 2021 On 6/29/2021 at 4:56 PM, Preetham M R said: We have tried with below base URI and still we are getting the problem. kindly advise and let me know if possible to have call. var configuration = ShareFile.Api.Client.Configuration.Default(); configuration.Logger = new DefaultLoggingProvider(); var sfClient = new ShareFileClient("https://secure.sf-api.com/sf/v3/", configuration); var OauthClientId = "xxxxxx"; var OauthClientSecret = "xxxxxx"; var oauthService = new OAuthService( sfClient, OauthClientId, OauthClientSecret); var oauthToken = oauthService.PasswordGrantAsync( "mailid@mail.com", "password", "subdomain", "sharefile.com",).Result; sfClient.AddOAuthCredentials(oauthToken); sfClient.BaseUri = oauthToken.GetUri(); return sfClient; Quote On 6/29/2021 at 4:56 PM, Preetham M R said: Hi, Looks like you are passing an empty/null string when creating an object of ShareFile.Api.Client.ShareFileClient class. Can you please send the appropriate base Uri and try? Accepted values for BaseUri are "https://secure.sf-api.com/sf/v3/", "https://secure.sf-api.eu/sf/v3/", "https://<YourSubdomain>.sf-api.com/sf/v3/", "https://<YourSubdomain>.sf-api.eu/sf/v3/" Thanks! Link to comment
0 Preetham M R Posted August 2, 2021 Share Posted August 2, 2021 On 6/27/2021 at 6:57 PM, Ravi Babu Oruganti said: Hi, The ShareFileClient constructor merely creates a new object of "System.Uri" class with the passed string. Can you please try adding the following code => var uri = new System.Uri("https://secure.sf-api.com/sf/v3/"); just before the line => var sfClient = new ShareFileClient("https://secure.sf-api.com/sf/v3/", configuration); and see whether the newly added line throws the same error? Thanks! Link to comment
Question
Ravi Babu Oruganti
Dear Team,
We are getting the below error message when we are using the citrix sharefile API service from application.
kindly advise and do the needful on this issue.
System.UriFormatException was unhandled
HResult=-2146233033
Message=Invalid URI: The URI is empty.
Source=System
StackTrace:
at System.Uri.CreateThis(String uri, Boolean dontEscape, UriKind uriKind)
at System.Uri..ctor(String uriString)
at ShareFile.Api.Client.ShareFileClient..ctor(String baseUri, Configuration configuration)
at ShareFile.ShareFileService.PasswordAuthentication() in D:\Netways\alezeik\Api\ShareFile\ShareFile\ShareFileService.cs:line 79
at ShareFile.ShareFileService.Login() in D:\Netways\alezeik\Api\ShareFile\ShareFile\ShareFileService.cs:line 21
at ShareFile.Program.Main(String[] args) in D:\Netways\alezeik\Api\ShareFile\ShareFile\Program.cs:line 14
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
---------------
Link to comment
3 answers to this question
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now