Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Find out File Owner/Creator in C# [duplicate]

Possible Duplicate:
Getting / setting file owner in C#

I searched the Internet but didn't found out how to get the File Creator/Owner In the FileInfo Class are only other Attributes like lastAccessTime, Size, but not the Owner/Creator.

Does somebody know the answer?

like image 488
Alex Avatar asked Sep 16 '11 13:09

Alex


1 Answers

string user = System.IO.File.GetAccessControl(path).GetOwner(typeof(System.Security.Principal.NTAccount)).ToString();

[EDIT] for newer .net versions, you will need to install System.IO.FileSystem.AccessControl

like image 194
Olivier Avatar answered Nov 01 '22 01:11

Olivier