Sharepoint 根据文件相对路径获取操作SPFolder
Posted lishidefengchen
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Sharepoint 根据文件相对路径获取操作SPFolder相关的知识,希望对你有一定的参考价值。
public AjaxResult LoadDocInfo(HttpContext httpContext) { var result = new ArrayList(); try { var orgId = httpContext.Request["orgId"]; var curFolder = DataFactory.GetOrganizationAppService().FindOrganizationsById(orgId); var curFolderPath = GetFolderPath(curFolder);//中国一维金融集团/弘达资本集团/上海中锋保理/业务部 var curSite = SPContext.Current.Site; var curWeb = SPContext.Current.Web; SPSecurity.RunWithElevatedPrivileges(delegate { using (var site = new SPSite(curSite.ID)) { using (var web = site.OpenWeb(curWeb.ID)) { SPFolder folder = web.GetFolder("/" + web.Name + "/Shared Documents/" + curFolderPath); if (folder != null) { foreach (SPFile sf in folder.Files) { result.Add(new { id = sf.UniqueId, name = sf.Name, length = sf.Length }); } } } } }); return new AjaxResult(true, result); } catch (Exception ex) { LogHelper.WriteLog(LogArea.Service, LogLevelType.ERROR, "OrganizationService-LoadDocInfo", ex); return new AjaxResult(false, ex.Message); } }
以上是关于Sharepoint 根据文件相对路径获取操作SPFolder的主要内容,如果未能解决你的问题,请参考以下文章