public IItem GetItem(ISiteSetting siteSetting, string itemUrl, out Sobiens.Connectors.Entities.Folder itemFolder) { ICRMService spService = new CRMService(); itemFolder = null; return(null); }
public IItem GetItem(ISiteSetting siteSetting, string itemUrl, out Sobiens.Connectors.Entities.Folder itemFolder) { FileInfo fi = new FileInfo(itemUrl); itemFolder = new FSFolder(siteSetting.ID, fi.Directory); return(new FSItem(siteSetting.ID, fi)); }
public List <Sobiens.Connectors.Entities.Folder> GetFolders(ISiteSetting siteSetting, Sobiens.Connectors.Entities.Folder parentFolder, int[] includedFolderTypes) { List <Sobiens.Connectors.Entities.Folder> subFolders = new List <Sobiens.Connectors.Entities.Folder>(); if (parentFolder as CRMWeb != null) { CRMWeb web = (CRMWeb)parentFolder; try { List <CRMEntity> lists = this.GetLists(siteSetting); foreach (CRMEntity list in lists) { /* * if (list.Hidden == true) * continue; * if (includedFolderTypes != null && includedFolderTypes.Contains(list.ServerTemplate) == false) * continue; * if (includedFolderTypes == null && list.ServerTemplate != 101 && list.ServerTemplate != 100 && list.BaseType != 1 && list.BaseType != 0) * continue; */ subFolders.Add(list); } } catch (Exception ex) { string message = string.Format("CRMService GetLists method returned error:{0}", ex.Message); Logger.Error(message, "Service"); } } else if (parentFolder as CRMEntity != null) { CRMEntity _folder = (CRMEntity)parentFolder; //List<Folder> folders = new List<Folder>(); //subFolders.Add(new CRMViewCollection(_folder, "Views", siteSetting.ID)); /* * foreach (SPFolder __folder in folders) * { * //__folder.ParentFolder = _folder; * subFolders.Add(__folder); * } */ } /* * else if (parentFolder as CRMViewCollection != null) * { * CRMViewCollection _folder = (CRMViewCollection)parentFolder; * * if (_folder.Title.Equals("Views") == true) * { * subFolders.Add(new CRMViewCollection(_folder.Entity, "Views shared with me", siteSetting.ID)); * subFolders.Add(new CRMViewCollection(_folder.Entity, "All views", siteSetting.ID)); * } * else if (_folder.Title.Equals("Views shared with me") == true) * { * subFolders.Add(new CRMViewCollection(_folder.Entity, "Views shared with me", siteSetting.ID)); * subFolders.Add(new CRMViewCollection(_folder.Entity, "All views", siteSetting.ID)); * } * else if (_folder.Title.Equals("All views") == true) * { * List<CRMView> views = GetAllViews(siteSetting, _folder.Entity); * subFolders.AddRange(views); * } * * } */ return(subFolders); }
public Folder GetWorkflowFolder(ISiteSetting siteSetting, Sobiens.Connectors.Entities.Folder itemFolder, string itemUrl) { throw new Exception("Not implemented yet"); }
private void AttachmentsToSPButton_Click(object sender, RibbonControlEventArgs e) { Inspector inspector = this.Context as Inspector; if (inspector == null) { throw new System.Exception("This is not an inspector window."); } Outlook.MailItem mailItem = inspector.CurrentItem as Outlook.MailItem; if (mailItem == null) { throw new System.Exception("This is not a mail item."); } Sobiens.Connectors.Entities.Folder defaultAttachmentSaveFolder = ConfigurationManager.GetInstance().GetDefaultAttachmentSaveFolder(); if (defaultAttachmentSaveFolder == null || ConfigurationManager.GetInstance().DontAskSaveAttachmentLocation == false) { SiteContentSelections siteContentSelections = new SiteContentSelections(); SiteSettings siteSettings = ConfigurationManager.GetInstance().GetSiteSettings(); List <ExplorerLocation> locations = ConfigurationManager.GetInstance().GetExplorerLocations(Sobiens.Connectors.Common.ApplicationContext.Current.GetApplicationType()); List <Sobiens.Connectors.Entities.Folder> folders = ConfigurationManager.GetInstance().GetFoldersByExplorerLocations(locations, false); siteContentSelections.InitializeForm(siteSettings, folders, true, null); if (defaultAttachmentSaveFolder != null) { siteContentSelections.SetSelectedFolder(defaultAttachmentSaveFolder); } if (siteContentSelections.ShowDialog(null, Languages.Translate("Select attachment upload location")) == false) { return; } if (siteContentSelections.SelectedFolder == null) { return; } defaultAttachmentSaveFolder = siteContentSelections.SelectedFolder; } SiteSetting siteSetting = ConfigurationManager.GetInstance().GetSiteSetting(defaultAttachmentSaveFolder.SiteSettingID); IServiceManager serviceManagerFactory = ServiceManagerFactory.GetServiceManager(siteSetting.SiteSettingType); string sourceFolder = ConfigurationManager.GetInstance().CreateATempFolder(); List <Sobiens.Connectors.Entities.UploadItem> emailUploadFiles = new List <Sobiens.Connectors.Entities.UploadItem>(); for (int i = mailItem.Attachments.Count; i > 0; i--) { Attachment attachment = mailItem.Attachments[i]; string fileName = attachment.FileName; string extensionName = String.Empty; string filenameWithoutExtension = String.Empty; if (fileName.LastIndexOf(".") > -1) { extensionName = fileName.Substring(fileName.LastIndexOf(".") + 1); filenameWithoutExtension = fileName.Substring(0, fileName.LastIndexOf(".")); } else { filenameWithoutExtension = fileName; } string newFileName = string.Format("{0}_{1}.{2}", filenameWithoutExtension, DateTime.Now.ToString("yyyy_MM_dd_HH_mm_ss"), extensionName); string filePath = string.Format("{0}\\{1}", sourceFolder, newFileName); attachment.SaveAsFile(filePath); Sobiens.Connectors.Entities.UploadItem uploadItem = new Entities.UploadItem(); uploadItem.FilePath = filePath; uploadItem.Folder = defaultAttachmentSaveFolder; uploadItem.FieldInformations = new Dictionary <object, object>(); Sobiens.Connectors.Common.ApplicationContext.Current.UploadFile(siteSetting, uploadItem, null, false, false, Upload_Success, Upload_Failed); string fileUrl = defaultAttachmentSaveFolder.GetUrl() + "/" + newFileName; if (mailItem.BodyFormat == OlBodyFormat.olFormatHTML) { mailItem.HTMLBody = "<a href='" + fileUrl + "'>" + fileUrl + "</a><br>" + mailItem.HTMLBody; } else { mailItem.Body = fileUrl + Environment.NewLine + mailItem.Body; } mailItem.Attachments[i].Delete(); } }
public Folder GetWorkflowFolder(ISiteSetting siteSetting, Sobiens.Connectors.Entities.Folder itemFolder, string itemUrl) { ISharePointService spService = new SharePointService(); return(spService.GetList(siteSetting, itemFolder.GetWebUrl() + itemFolder.GetRoot())); }
public IItem GetItem(ISiteSetting siteSetting, string itemUrl, out Sobiens.Connectors.Entities.Folder itemFolder) { ISharePointService spService = new SharePointService(); return(spService.GetItem(siteSetting, itemUrl, out itemFolder)); }
public Folder GetWorkflowFolder(ISiteSetting siteSetting, Sobiens.Connectors.Entities.Folder itemFolder, string itemUrl) { ICRMService spService = new CRMService(); return(null); }
public IItem GetItem(ISiteSetting siteSetting, string itemUrl, out Sobiens.Connectors.Entities.Folder itemFolder) { throw new Exception("Not implemented yet"); }
public List <Sobiens.Connectors.Entities.Folder> GetFolders(ISiteSetting siteSetting, Sobiens.Connectors.Entities.Folder parentFolder, int[] includedFolderTypes) { List <Sobiens.Connectors.Entities.Folder> subFolders = new List <Sobiens.Connectors.Entities.Folder>(); if (parentFolder as Sobiens.Connectors.Entities.SQLServer.SQLServer != null) { Sobiens.Connectors.Entities.SQLServer.SQLServer sqlServer = (Sobiens.Connectors.Entities.SQLServer.SQLServer)parentFolder; try { using (SqlConnection con = new SqlConnection(this.GetConnectionString(siteSetting, string.Empty))) { con.Open(); // Set up a command with the given query and associate // this with the current connection. using (SqlCommand cmd = new SqlCommand("SELECT name from sys.databases", con)) { using (IDataReader dr = cmd.ExecuteReader()) { while (dr.Read()) { string dbName = dr[0].ToString(); if (dbName.Equals("master", StringComparison.InvariantCultureIgnoreCase) == false && dbName.Equals("model", StringComparison.InvariantCultureIgnoreCase) == false && dbName.Equals("tempdb", StringComparison.InvariantCultureIgnoreCase) == false && dbName.Equals("msdb", StringComparison.InvariantCultureIgnoreCase) == false ) { SQLDB list = new SQLDB(dbName, siteSetting.ID, dbName); subFolders.Add(list); } } } } } } catch (Exception ex) { string message = string.Format("SharePointService GetWebs method returned error:{0}", ex.Message); Logger.Error(message, "Service"); } } else if (parentFolder as SQLDB != null) { using (SqlConnection connection = new SqlConnection(this.GetConnectionString(siteSetting, parentFolder.Title))) { connection.Open(); DataTable schema = connection.GetSchema("Tables"); foreach (DataRow row in schema.Rows) { string tableName = row[2].ToString(); SQLTable table = new SQLTable(tableName, siteSetting.ID, tableName, parentFolder.Title); //table.ListName = parentFolder.Title; subFolders.Add(table); } } } return(subFolders); }
public List <Sobiens.Connectors.Entities.Folder> GetFolders(ISiteSetting siteSetting, Sobiens.Connectors.Entities.Folder parentFolder) { return(GetFolders(siteSetting, parentFolder, null)); }