public Folder GetRootFolder(ISiteSetting siteSetting) { ISharePointService spService = new SharePointService(); return(spService.GetWeb(siteSetting, siteSetting.Url)); //return new SPWeb(siteSetting.Url, siteSetting.Url, siteSetting.ID, siteSetting.Url, siteSetting.Url, siteSetting.Url); }
/// <summary> /// Return Parent Folder with object /// </summary> /// <param name="siteSetting">Site Setting</param> /// <param name="folder">Folder to retreive</param> /// <returns></returns> public Folder GetParentFolder(ISiteSetting siteSetting, Folder folder) { SPBaseFolder spFolder = folder as SPBaseFolder; string folderPath = spFolder.WebUrl.CombineUrl(spFolder.FolderPath).TrimEnd(new char[] { '/' }); if (folderPath.Equals(siteSetting.Url, StringComparison.OrdinalIgnoreCase) == true) { return(null); } //folderPath = folderPath.Substring(0, folderPath.LastIndexOf('/'));//JD folderPath = folderPath.TrimEnd('/'); ISharePointService spService = new SharePointService(); if (folder as SPList != null) { //return spService.GetWeb(siteSetting, folderPath); return(spService.GetList(siteSetting, folderPath)); } else if (folder as SPWeb != null) { return(spService.GetWeb(siteSetting, folderPath)); } else { if (folder.GetRoot() == folder.GetUrl()) { return(spService.GetList(siteSetting, folderPath)); } return(spService.GetList(siteSetting, folderPath)); //return spService.GetFolder(siteSetting, folderPath); } }
public bool CheckConnection(ISiteSetting siteSetting) { SharePointService spService = new SharePointService(); SPWeb web = null; try { web = spService.GetWeb(siteSetting, siteSetting.Url); } catch { } return(web == null ? false : true); }
public Folder GetFolder(ISiteSetting siteSetting, BasicFolderDefinition folderDefinition) { ISharePointService spService = new SharePointService(); if (typeof(SPList).FullName.Equals(folderDefinition.FolderType, StringComparison.OrdinalIgnoreCase) == true) { return(spService.GetList(siteSetting, folderDefinition.FolderUrl)); } else if (typeof(SPWeb).FullName.Equals(folderDefinition.FolderType, StringComparison.OrdinalIgnoreCase) == true) { return(spService.GetWeb(siteSetting, folderDefinition.FolderUrl)); } else { return(spService.GetFolder(siteSetting, folderDefinition.FolderUrl)); } }