198
Views
9
Comments
Solved
[FileSystem]  how to set domain and path
Question

I am using [FileSystem] from forge 
I have access to Shared folder on server with username and password
path is                \\hqislm1.sodic.inv.sa\HQ_QA
I trayed to set File_writeBinary parameters as 
content :FileContent
Path : "\\hqislm1.sodic.inv.sa\HQ_QA\Filename"
Domain : Itrayed all this [ hqislm1.sodic.inv.sa  and   \\hqislm1.sodic.inv.sa  and   ""]
username : folderUsername
Password : folderPassword
but I always got an error 
I need help to Know my fault 
thank you

2022-03-29 14-13-57
Hassan Shaddad
Solution

I found the problem


this line of code

 if (LogonUser(ssUsername, ssDomain, ssPassword, 9, 0, out phToken) != 0)

need to be 

 if (LogonUser(ssUsername, ssDomain, ssPassword, 3, 0, out phToken) != 0)

as LogonUserA function take types of logon from 1 to 7 only 

and i think the best choice is LOGON32_LOGON_NETWORK = 3

so extension could access shared folders with username and password correctly 

2020-09-15 13-07-23
Kilian Hekhuis
 
MVP

Hi Hassan,

I'll try to check the above, and if I agree with the above change, I'll update the Forge asset. Thanks!

2022-03-29 14-13-57
Hassan Shaddad

Hi Kilian 
I am so sorry I was wrong
the extension works great as it is 

2020-09-15 13-07-23
Kilian Hekhuis
 
MVP

Ok, thanks for the feedback, that saves me some trouble :).

2020-09-15 13-07-23
Kilian Hekhuis
 
MVP

Hi Hassan,

What error do you get?

2022-03-29 14-13-57
Hassan Shaddad


with this config 
Path : \\hqislm1.sodic.inv.sa\HQ_QA\Filename
Domain :  hqislm1.sodic.inv.sa 
username : folderUsername
Password : folderPassword 

I got this error

Win32Error: 1326
System.IO.DirectoryNotFoundException: Could not find a part of the path '\\hqislm1.sodic.inv.sa\HQ_QA '.
   at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   at System.IO.Directory.InternalCreateDirectory(String fullPath, String path, Object dirSecurityObj, Boolean checkHost)
   at System.IO.Directory.InternalCreateDirectoryHelper(String path, Boolean checkHost)
   at OutSystems.NssFileSystem.CssFileSystem.MssDirectory_Create(String ssPath, String ssDomain, String ssUsername, String ssPassword, String& ssError_message)

Kindly note that               HQ_QA    is the shared folder

2020-09-15 13-07-23
Kilian Hekhuis
 
MVP

Well, "directory not found" is clear, the directory is not there. It's not a matter of privileges, you'd get a different error then. Is it an on-premise installation of the Platform, or cloud? If the latter, does the cloud server have access to the destination server?

UserImage.jpg
jigui yang

Hello, I have also encountered the same situation as you. How did you resolve the issue of "Could not find a part of the path"

2022-03-29 14-13-57
Hassan Shaddad

Thank you Kilian ,
After fixing my configuration I got this error Now

Win32Error: 0
System.UnauthorizedAccessException: Access to the path 'path '\\hqislm1.sodic.inv.sa\HQ_QA \hosts.txt' is denied. 
 at Microsoft.Win32.SafeHandles.SafeFileHandle.CreateFile(String fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options)

   at Microsoft.Win32.SafeHandles.SafeFileHandle.Open(String fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize)

Thank you for your help

    

 

2022-03-29 14-13-57
Hassan Shaddad
Solution

I found the problem


this line of code

 if (LogonUser(ssUsername, ssDomain, ssPassword, 9, 0, out phToken) != 0)

need to be 

 if (LogonUser(ssUsername, ssDomain, ssPassword, 3, 0, out phToken) != 0)

as LogonUserA function take types of logon from 1 to 7 only 

and i think the best choice is LOGON32_LOGON_NETWORK = 3

so extension could access shared folders with username and password correctly 

2020-09-15 13-07-23
Kilian Hekhuis
 
MVP

Hi Hassan,

I'll try to check the above, and if I agree with the above change, I'll update the Forge asset. Thanks!

2022-03-29 14-13-57
Hassan Shaddad

Hi Kilian 
I am so sorry I was wrong
the extension works great as it is 

2020-09-15 13-07-23
Kilian Hekhuis
 
MVP

Ok, thanks for the feedback, that saves me some trouble :).

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.