Toby,
This is totally untested and I have no idea if you could use this. But
you
might want to look into the WMI classes in the .NET framework. Here is
some (untested) code to get you started. Perhaps someone can fill in the
blanks.
ManagementObjectSearcher query =
new ManagementObjectSearcher("SELECT * From Win32_DiskQuota");
ManagementObjectCollection queryCollection = query.Get();
foreach ( ManagementObject mo in queryCollection)
Console.WriteLine(mo.ToString());
Console.ReadLine();
Other than this you could use the IDiskQuotaControl interface and any
Disk Quota API:s available in Win32 using p/Invoke.
HTH,
//Andreas
Nicholas Paldino said:
Toby,
You will have to define the IDiskQuotaControl interface in your code,
using the attributes from the System.Runtime.InteropServices namespace.
Once you have this, you can get the type of the COM component from a call to
the static GetTypeFromCLSID method on the Type class. With that, you can
pass the type to the static CreateInstance method on the Activator class,
and cast the return type to the IDiskQuotaControl interface you declared in
code.
Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)
Toby Mathews said:
Hi there,
Can anyone help me get started (preferably in C#) using IDiskQuotaControl
to set disk quotas for users? I am baffled and can only find C++ examples.
Thanks in advance,
Toby Mathews