Problem with API Call WNetAddConnection2

I have some script that is trying to map a drive using WNetAddConnection2; it’s returning error code 1312. I suspect this might be a security issue, but things on the server side are not my strongpoint. I’ve Googled the error, and desipte findind a bunch of hits haven’t really been able to find anything that helps me. I do know this coded used to work, then started working sporadically, and now does not work at all.

Any help would be HUGELUY appreciated.

Subject: Problem with API Call WNetAddConnection2

You might try this function to produce the text of the error message:

Sub showError(rc As Integer, msg As String)

’ Put this line in the declartions section

'Declare Function OSLoadString Lib “nnotes.dll” (Byval hMod As Long, Byval strCode As Integer, Byval strBuf As String, Byval bufLen As Integer) As Integer

Dim errmsg As String*256

Dim emsg As String

Dim i As Integer



Call W32_OSLoadString(0, rc, errmsg, 255)

i = Instr(errmsg, Chr$(0))

If i > 0 Then

	errmsg = Left$(errmsg, i - 1)

End If

Messagebox "Error: [" + Trim$(errmsg) + "]  executing: "  + msg, 16, " Error" 

End Sub