I wanted to pull data about the connected network users from the Computer Management -> Shared Folders -> Sessions tab into my c# application. Can anybody guide me on what namespaces have to be used along with some sample code to import username and ip address from Computer Management -> Shared Folders -> Sessions tab?
Regards
You don't want to interact with Computer Management, you want to call the same functions it does and cut the middle man out of the loop.
For finding out about current network connection, you might be looking for WNetOpenEnum or NetConnectionEnum
I don't think there's a .NET function for this in the BCL, you'd have to use p/invoke or look for a third-party library (or my personal favorite, use C++/CLI to write a wrapper)
You want NetSessionEnum, which:
When passed a level of 502, it'll return an array of:
Luckily for you, pinvoke.net has the necessary signatures and even some sample code. Here's a full featured sample: