找出在C#中的文件所有者/创建者 [英] Find out File Owner/Creator in C#

查看:385
本文介绍了找出在C#中的文件所有者/创建者的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


可能重复:结果
在C#中获取 /设置文件所有者






我在网上搜索,但没有发现如何让文件创建者/所有者
在FileInfo类是唯一的其他属性,如的LastAccessTime,尺寸,而不是所有者/创建者。



是否有人知道答案?


解决方案

 字符串用户=系统.IO.File.GetAccessControl(路径).GetOwner(typeof运算(System.Security.Principal.NTAccount))的ToString()。 


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?

解决方案

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

这篇关于找出在C#中的文件所有者/创建者的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆