Hi
How can i look for network share folders and copy a text file to it? I've
been looking into how i can do this in the documention but with no luck. I
found a little on of the web but i dont understand it, it seems to import
mpr.dll and make the use of c++ calls. Can this be just done by c#?
If so how?
Jamie C 6 2710
Jamie C,
Why not just use the static Copy method on the File class?
Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com
"Default User" <an*******@discussions.microsoft.com> wrote in message
news:51**********************************@microsof t.com... Hi How can i look for network share folders and copy a text file to it? I've been looking into how i can do this in the documention but with no luck. I found a little on of the web but i dont understand it, it seems to import mpr.dll and make the use of c++ calls. Can this be just done by c#? If so how?
Jamie C
But how do i find the network share drives to start with?
The example i've been looking at imports a dll,
[DllImport("mpr.dll")]
public static extern int WNetOpenEnum(ResourceScope dwScope, ResourceType
dwType, ResourceUsage dwUsage, NETRESOURCE lpNetResource, out IntPtr
lphEnum);
like but i cant find any examples in straight c#
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote in
message news:OP**************@TK2MSFTNGP09.phx.gbl... Jamie C,
Why not just use the static Copy method on the File class?
Hope this helps.
-- - Nicholas Paldino [.NET/C# MVP] - mv*@spam.guard.caspershouse.com
"Default User" <an*******@discussions.microsoft.com> wrote in message news:51**********************************@microsof t.com... Hi How can i look for network share folders and copy a text file to it? I've been looking into how i can do this in the documention but with no luck. I found a little on of the web but i dont understand it, it seems to import mpr.dll and make the use of c++ calls. Can this be just done by c#? If so how?
Jamie C
Jamie,
This could be a huge task. Are you looking for all of the network
shares exposed on one machine, or in the whole network?
If you know the machine you want to look for the shares on, then I would
use the classes in the System.Management namespace to query for all
instances of Win32_Share where the Type is 0. You can use pass a
ManagementPath instance (with the server specified) to the constructor of
the ManagementClass object to indicate that you want the query performed on
that machine.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com
"Default User" <an*******@discussions.microsoft.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl... But how do i find the network share drives to start with? The example i've been looking at imports a dll, [DllImport("mpr.dll")]
public static extern int WNetOpenEnum(ResourceScope dwScope, ResourceType dwType, ResourceUsage dwUsage, NETRESOURCE lpNetResource, out IntPtr lphEnum);
like but i cant find any examples in straight c# "Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote in message news:OP**************@TK2MSFTNGP09.phx.gbl... Jamie C,
Why not just use the static Copy method on the File class?
Hope this helps.
-- - Nicholas Paldino [.NET/C# MVP] - mv*@spam.guard.caspershouse.com
"Default User" <an*******@discussions.microsoft.com> wrote in message news:51**********************************@microsof t.com... Hi How can i look for network share folders and copy a text file to it? I've been looking into how i can do this in the documention but with no luck. I found a little on of the web but i dont understand it, it seems to import mpr.dll and make the use of c++ calls. Can this be just done by c#? If so how?
Jamie C
i'd need it to search the whole network, as file servers are being added or
drives being mapped all the time, and i need to put a disclaimer on the root
of each one. After a while it takes its tole keep copying and pasting all
the time :(
Jamie
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote in
message news:uO**************@TK2MSFTNGP09.phx.gbl... Jamie,
This could be a huge task. Are you looking for all of the network shares exposed on one machine, or in the whole network?
If you know the machine you want to look for the shares on, then I would use the classes in the System.Management namespace to query for all instances of Win32_Share where the Type is 0. You can use pass a ManagementPath instance (with the server specified) to the constructor of the ManagementClass object to indicate that you want the query performed on that machine.
-- - Nicholas Paldino [.NET/C# MVP] - mv*@spam.guard.caspershouse.com
"Default User" <an*******@discussions.microsoft.com> wrote in message news:%2****************@TK2MSFTNGP10.phx.gbl... But how do i find the network share drives to start with? The example i've been looking at imports a dll, [DllImport("mpr.dll")]
public static extern int WNetOpenEnum(ResourceScope dwScope, ResourceType dwType, ResourceUsage dwUsage, NETRESOURCE lpNetResource, out IntPtr lphEnum);
like but i cant find any examples in straight c# "Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote in message news:OP**************@TK2MSFTNGP09.phx.gbl... Jamie C,
Why not just use the static Copy method on the File class?
Hope this helps.
-- - Nicholas Paldino [.NET/C# MVP] - mv*@spam.guard.caspershouse.com
"Default User" <an*******@discussions.microsoft.com> wrote in message news:51**********************************@microsof t.com... Hi How can i look for network share folders and copy a text file to it? I've been looking into how i can do this in the documention but with no luck. I found a little on of the web but i dont understand it, it seems to import mpr.dll and make the use of c++ calls. Can this be just done by c#? If so how?
Jamie C
That means you need need access privileges for all these shares too! What
makes you think you will have these?
Willy.
"Default User" <an*******@discussions.microsoft.com> wrote in message
news:uf*************@TK2MSFTNGP12.phx.gbl... i'd need it to search the whole network, as file servers are being added or drives being mapped all the time, and i need to put a disclaimer on the root of each one. After a while it takes its tole keep copying and pasting all the time :(
Jamie
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote in message news:uO**************@TK2MSFTNGP09.phx.gbl... Jamie,
This could be a huge task. Are you looking for all of the network shares exposed on one machine, or in the whole network?
If you know the machine you want to look for the shares on, then I would use the classes in the System.Management namespace to query for all instances of Win32_Share where the Type is 0. You can use pass a ManagementPath instance (with the server specified) to the constructor of the ManagementClass object to indicate that you want the query performed on that machine.
-- - Nicholas Paldino [.NET/C# MVP] - mv*@spam.guard.caspershouse.com
"Default User" <an*******@discussions.microsoft.com> wrote in message news:%2****************@TK2MSFTNGP10.phx.gbl... But how do i find the network share drives to start with? The example i've been looking at imports a dll, [DllImport("mpr.dll")]
public static extern int WNetOpenEnum(ResourceScope dwScope, ResourceType dwType, ResourceUsage dwUsage, NETRESOURCE lpNetResource, out IntPtr lphEnum);
like but i cant find any examples in straight c# "Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote in message news:OP**************@TK2MSFTNGP09.phx.gbl... Jamie C,
Why not just use the static Copy method on the File class?
Hope this helps.
-- - Nicholas Paldino [.NET/C# MVP] - mv*@spam.guard.caspershouse.com
"Default User" <an*******@discussions.microsoft.com> wrote in message news:51**********************************@microsof t.com... > Hi > How can i look for network share folders and copy a text file to it? > I've been looking into how i can do this in the documention but with > no luck. I found a little on of the web but i dont understand it, it > seems to import mpr.dll and make the use of c++ calls. Can this be > just done by c#? > If so how? > > Jamie C
Like i said before i've been copying and pasting these files to the drives
manually, which takes far too long, so i must have the privileges to do it
manually would i not?
"Willy Denoyette [MVP]" <wi*************@telenet.be> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl... That means you need need access privileges for all these shares too! What makes you think you will have these?
Willy.
"Default User" <an*******@discussions.microsoft.com> wrote in message news:uf*************@TK2MSFTNGP12.phx.gbl... i'd need it to search the whole network, as file servers are being added or drives being mapped all the time, and i need to put a disclaimer on the root of each one. After a while it takes its tole keep copying and pasting all the time :(
Jamie
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote in message news:uO**************@TK2MSFTNGP09.phx.gbl... Jamie,
This could be a huge task. Are you looking for all of the network shares exposed on one machine, or in the whole network?
If you know the machine you want to look for the shares on, then I would use the classes in the System.Management namespace to query for all instances of Win32_Share where the Type is 0. You can use pass a ManagementPath instance (with the server specified) to the constructor of the ManagementClass object to indicate that you want the query performed on that machine.
-- - Nicholas Paldino [.NET/C# MVP] - mv*@spam.guard.caspershouse.com
"Default User" <an*******@discussions.microsoft.com> wrote in message news:%2****************@TK2MSFTNGP10.phx.gbl... But how do i find the network share drives to start with? The example i've been looking at imports a dll, [DllImport("mpr.dll")]
public static extern int WNetOpenEnum(ResourceScope dwScope, ResourceType dwType, ResourceUsage dwUsage, NETRESOURCE lpNetResource, out IntPtr lphEnum);
like but i cant find any examples in straight c# "Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote in message news:OP**************@TK2MSFTNGP09.phx.gbl... > Jamie C, > > Why not just use the static Copy method on the File class? > > Hope this helps. > > > -- > - Nicholas Paldino [.NET/C# MVP] > - mv*@spam.guard.caspershouse.com > > "Default User" <an*******@discussions.microsoft.com> wrote in message > news:51**********************************@microsof t.com... >> Hi >> How can i look for network share folders and copy a text file to it? >> I've been looking into how i can do this in the documention but with >> no luck. I found a little on of the web but i dont understand it, it >> seems to import mpr.dll and make the use of c++ calls. Can this be >> just done by c#? >> If so how? >> >> Jamie C > >
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Jonas |
last post by:
Good day, I have a .bat script I'm invoking thru a cgi script (PERL)
with (NT/IIS) on a internal network. The .bat script is having
problems accessing network drives, it keeps saying "Invalid...
|
by: Leo R |
last post by:
Hi,
Is it possible to create a network-drive at the SYSTEM-level? E.g.: map X:
to \\server1\share so a windows service can reach X: without having to log
on? I want a Windows .NET service to...
|
by: Eric.Jones |
last post by:
I've encountered a strange error with loading delimited files from a
Samba (SMB) network drive, has anyone else seen this before?
(Platform: WinXP Pro, UDB PE 8015, level 02060106, SAMPLE db)
...
|
by: ddsvi78 |
last post by:
I am a complete idiot when it comes to access. Now that said, I work
for a computer security company and one of our customers came to us
with an access problem.
They had been running fine for a...
|
by: Niloday |
last post by:
Hi All,
I am trying to access a mapped network drive from a service that I have
created.
The service needs to create/delete folders/files on a network drive. When I
tried to connect to a...
|
by: Nirosh |
last post by:
Hi All,
Can any one suggest me a best way to do this ..
I have a thrid party tool "EXE" that we need to use with our web service to
manipulate some complex XML files, which reside in a...
|
by: Matt Dockerty |
last post by:
Hi,
I'm trying to connect to a network share using a username / password /
domain of my choosing.
I've tried the WindowsIdentity.Impersonate route but can only impersonate
the users on the...
|
by: Andre |
last post by:
Hi,
I have ASP.NET application running on standalone (not part of the domain)
Windows 2003. I use forms authentication for my application. The problem I
have is that I need to create and read...
|
by: =?Utf-8?B?QnJpYW4gTmljaG9sc29u?= |
last post by:
Hello,
I'm trying to create an admin page that can run miscellaneous scripts for
our IT department. Currently, I'm trying to create a script that can map a
network drive for a user (e.g. a form...
|
by: lllomh |
last post by:
Define the method first
this.state = {
buttonBackgroundColor: 'green',
isBlinking: false, // A new status is added to identify whether the button is blinking or not
}
autoStart=()=>{
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM)
The start time is equivalent to 19:00 (7PM) in Central...
|
by: Aliciasmith |
last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
|
by: giovanniandrean |
last post by:
The energy model is structured as follows and uses excel sheets to give input data:
1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
|
by: NeoPa |
last post by:
Hello everyone.
I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report).
I know it can be done by selecting :...
|
by: Teri B |
last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course.
0ne-to-many. One course many roles.
Then I created a report based on the Course form and...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM)
Please note that the UK and Europe revert to winter time on...
|
by: NeoPa |
last post by:
Introduction
For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
|
by: isladogs |
last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, Mike...
| |