社区
SharePoint
帖子详情
别人共享一个sharepoint的文件夹给我,我想用代码控制,怎么连接?
yingang11
2020-05-28 05:18:44
别人共享一个sharepoint的文件夹给我,我希望通过c#代码操作这个文件夹,例如:新建子目录,上传文件等
但是不清楚该怎么连接这个文件夹,地址类似这种:
https://zfhk.sharepoint.com/:f:/s/JIM-ExCom2/EhFbuaoeYWJLk8NH4NvKGl4BuTFGNRuaR1BnOQitYSqOEA?email=xxxx%40xxxxuuuu.com&e=dZvO6E
...全文
182047
5
打赏
收藏
别人共享一个sharepoint的文件夹给我,我想用代码控制,怎么连接?
别人共享一个sharepoint的文件夹给我,我希望通过c#代码操作这个文件夹,例如:新建子目录,上传文件等 但是不清楚该怎么连接这个文件夹,地址类似这种: https://zfhk.sharepoint.com/:f:/s/JIM-ExCom2/EhFbuaoeYWJLk8NH4NvKGl4BuTFGNRuaR1BnOQitYSqOEA?email=xxxx%40xxxxuuuu.com&e=dZvO6E
复制链接
扫一扫
分享
转发到动态
举报
AI
作业
写回复
配置赞助广告
用AI写文章
5 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
霖雨
版主
2021-03-09
打赏
举报
回复
上面的代码很靠谱
「已注销」
2020-08-06
打赏
举报
回复
可以使用 COMS API 操作,楼上的Code应该就可以
mslearn-nashma
2020-06-06
打赏
举报
回复
private static void UploadFileToSharePoint(string SiteUrl, string DocLibrary, string ClientSubFolder, string FileName, string Login, string Password) { try { #region ConnectToSharePoint var securePassword = new SecureString(); foreach (char c in Password) { securePassword.AppendChar(c); } var onlineCredentials = new SP.SharePointOnlineCredentials(Login, securePassword); #endregion #region Insert the data using (SP.ClientContext CContext = new SP.ClientContext(SiteUrl)) { CContext.Credentials = onlineCredentials; SP.Web web = CContext.Web; SP.FileCreationInformation newFile = new SP.FileCreationInformation(); byte[] FileContent = System.IO.File.ReadAllBytes(FileName); newFile.ContentStream = new MemoryStream(FileContent); newFile.Url = Path.GetFileName(FileName); SP.List DocumentLibrary = web.Lists.GetByTitle(DocLibrary); //SP.Folder folder = DocumentLibrary.RootFolder.Folders.GetByUrl(ClientSubFolder); SP.Folder Clientfolder = DocumentLibrary.RootFolder.Folders.Add(ClientSubFolder); Clientfolder.Update(); SP.File uploadFile = Clientfolder.Files.Add(newFile); CContext.Load(DocumentLibrary); CContext.Load(uploadFile); CContext.ExecuteQuery(); Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine("The File has been uploaded"+Environment.NewLine+"FileUrl -->"+SiteUrl+"/"+DocLibrary+"/"+ClientSubFolder+"/" +Path.GetFileName(FileName)); } #endregion } catch (Exception exp) { Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine(exp.Message + Environment.NewLine + exp.StackTrace); } finally { Console.ReadLine(); } }
mslearn-nashma
2020-06-06
打赏
举报
回复
static void Main(string[] args) { string SiteUrl = "https://You.sharepoint.com/sites/Upload"; string DocumentLibrary = "UploadLibrary"; string FileName = @"C:\testupload.pdf"; string CustomerFolder = "1564_dsfgsst"; string UserName = "samir.daoudi@******.co.uk"; string Password = "*****"; UploadFileToSharePoint(SiteUrl, DocumentLibrary, CustomerFolder, FileName, UserName, Password); }
Justin-Liu
2020-06-02
打赏
举报
回复
你试试把这个文件夹用onedrive for business同步到本地,然后进行操作,网络畅通的话应该会自动同步
SP_SPA:使用Angular JS在
SharePoint
中开发SPA的示例
代码
SP_SPA:使用Angular JS在
SharePoint
中开发SPA的示例
代码
MOSS基础知识培训教程.pptx
MOSS基础知识培训教程.pptx
SharePoint
2007列表定义功能如何
这是一篇有关如何创建列表定义功能的文章。
XML Web 部件.rar
XML Web 部件
sharepoint
帮助文件的
一个
部分
owncloud手册
owncloud,
一个
云端平台,简单实用高效,同步传输速度非常快。
SharePoint
3,245
社区成员
4,605
社区内容
发帖
与我相关
我的任务
SharePoint
企业开发 SharePoint
复制链接
扫一扫
分享
社区描述
企业开发 SharePoint
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
暂无公告
试试用AI创作助手写篇文章吧
+ 用AI写文章