文件写入公共文档 [英] File write to Public Documents

查看:86
本文介绍了文件写入公共文档的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



文件先前写在文件夹中

喜欢,..



System.Environment .GetFolderPath(Environment.SpecialFolder.MyDocuments)





- 我需要写入Public Document文件夹吗?..

解决方案

我认为它无法直接访问。

但是,有一个技巧 -

首先使用公共文件夹的路径在系统上添加一个环境变量,然后使用 -

访问它System.Environment.GetEnvironmentVariable(  EnvVarName


string strMyDocument = System.Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData)+\\Folder_name;





此代码只接受3.5 C#CommonApplicationData我们可以访问所有用户..











C#4.0



System.Environment.GetFolderPath(Environment.SpecialFolder.CommonDocuments)+ \\Folder_name;

hi,
File writes previously in Documents Folder
like,..

System.Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments)


-I need to write in Public Document folder ?..

解决方案

i believe that it is not accessible directly.
But, there a trick-
First add an environment variable on the system with the path of public folder and then access it using-

System.Environment.GetEnvironmentVariable("EnvVarName")


string strMyDocument = System.Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + "\\Folder_name";


this code Accept only in 3.5 C# CommonApplicationData we can access all user ..


and


C# 4.0

System.Environment.GetFolderPath(Environment.SpecialFolder.CommonDocuments) + "\\Folder_name";


这篇关于文件写入公共文档的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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