Hi ,
problem is does not show the Map drive name after mapping.
here
is my code:
networks.LocalDrive = ddlDrive.SelectedItem.ToString();
networks.ShareName =
"\\\\servername\\foldername\\Shared%20Documents";networks.MapDrive(); below methond is mapdrive in visualwebpart.
private void zMapDrive(string psUsername, string psPassword)
{
//create struct data
structNetResource stNetRes = new structNetResource();
stNetRes.iScope = 2;
stNetRes.iType = RESOURCETYPE_DISK;
stNetRes.iDisplayType = 3;
stNetRes.iUsage = 1;
stNetRes.sRemoteName = ls_ShareName;
stNetRes.sLocalName = ls_Drive;
//prepare params
int iFlags = 0;
if (lf_SaveCredentials) { iFlags += CONNECT_CMD_SAVECRED; }
if (lf_Persistent) { iFlags += CONNECT_UPDATE_PROFILE; }
if (ls_PromptForCredentials) { iFlags += CONNECT_INTERACTIVE + CONNECT_PROMPT; }
if (psUsername == "") { psUsername = null; }
if (psPassword == "") { psPassword = null; }
//if force, unmap ready for new connection
if (lf_Force) { try { zUnMapDrive(true); } catch { } }
//call and return
int i = WNetAddConnection2A(ref stNetRes, psPassword, psUsername, iFlags);
if (i > 0) { throw new System.ComponentModel.Win32Exception(i); }
}
When I try to map to local "\\mycomputer\shared" that no issue. But When I try to map to sharepoint server that there is issues. my application is using VisualWebpart with C#.net and running in sharepoint
site and using Window 7 and Sharepoint 2010 pls help. thanks a lot.