private void editPropertiesToolStripMenuItem_Click(object sender, EventArgs e)
        {
            EUListItem           listItem         = (EUListItem)LibraryContentDataGridView.SelectedRows[0].Tag;
            EUFolder             folder           = SelectedFolder as EUFolder;
            List <EUContentType> contentTypes     = SharePointManager.GetContentTypes(folder.SiteSetting, folder.WebUrl, folder.ListName);
            EUFieldCollection    fields           = SharePointManager.GetFields(folder.SiteSetting, folder.WebUrl, folder.ListName);
            ListItemEditForm     listItemEditForm = new ListItemEditForm();

            listItemEditForm.InitializeForm(folder, listItem);
            listItemEditForm.ShowDialog();
            if (listItemEditForm.DialogResult != DialogResult.OK)
            {
                return;
            }


            Hashtable changedProperties = new Hashtable();

            if (listItemEditForm.FieldInformations.ContentType != null)
            {
                changedProperties.Add("ContentType", listItemEditForm.FieldInformations.ContentType.Name);
            }
            for (int i = 0; i < listItemEditForm.FieldInformations.Count(); i++)
            {
                changedProperties.Add(listItemEditForm.FieldInformations[i].InternalName, listItemEditForm.FieldInformations[i].Value);
            }
            SharePointManager.UpdateListItem(listItem.SiteSetting, listItem.WebURL, listItem.ListName, listItem.ID, changedProperties);
            RefreshViewExt();
        }
示例#2
0
        public static void UploadEmail(SharePointListViewControl listviewControl, ISPCFolder dragedFolder, DragEventArgs e, List <EUEmailUploadFile> emailUploadFiles, bool isListItemAndAttachmentMode)
        {
            try
            {
                EUFieldInformations fieldInformations = null;
                EUFieldCollection   fields            = null;

                UploadProgressForm uploadProgressForm = new UploadProgressForm();
                if (EUSettingsManager.GetInstance().Settings == null)
                {
                    MessageBox.Show("You need to configure settings first.");
                    SettingsForm settingsControl = new SettingsForm();
                    settingsControl.ShowDialog();
                    return;
                }

                if (dragedFolder as EUFolder != null)
                {
                    EUFolder             dragedSPFolder = dragedFolder as EUFolder;
                    List <EUContentType> contentTypes   = SharePointManager.GetContentTypes(dragedSPFolder.SiteSetting, dragedSPFolder.WebUrl, dragedSPFolder.ListName);
                    fields = SharePointManager.GetFields(dragedSPFolder.SiteSetting, dragedSPFolder.WebUrl, dragedSPFolder.ListName);
                    ListItemEditForm listItemEditForm = new ListItemEditForm();
                    listItemEditForm.InitializeForm(dragedSPFolder, null);
                    listItemEditForm.ShowDialog();

                    if (listItemEditForm.DialogResult != DialogResult.OK)
                    {
                        return;
                    }
                    foreach (EUEmailUploadFile emailUploadFile in emailUploadFiles)
                    {
                        emailUploadFile.FieldInformations = listItemEditForm.FieldInformations;
                    }
                }

                string sourceFolder = EUSettingsManager.GetInstance().CreateATempFolder();

                if (EUSettingsManager.GetInstance().Settings.UploadAutomatically == true || dragedFolder as FSFolder != null || dragedFolder as GFolder != null)
                {
                    if (listviewControl != null)
                    {
                        for (int i = 0; i < emailUploadFiles.Count; i++)
                        {
                            EUEmailUploadFile emailUploadFile = emailUploadFiles[i];
                            listviewControl.LibraryContentDataGridView.Rows.Insert(i, 1);
                            listviewControl.LibraryContentDataGridView.Rows[i].Tag = emailUploadFile.UniqueID.ToString();
                            if (dragedFolder as EUFolder != null)
                            {
                                listviewControl.LibraryContentDataGridView.Rows[i].Cells["ExtensionImageColumn"].Value = Sobiens.Office.SharePointOutlookConnector.Properties.Resources.ajax_loader;
                            }
                            string title = emailUploadFile.FilePath.Split('\\')[emailUploadFile.FilePath.Split('\\').Length - 1];
                            listviewControl.LibraryContentDataGridView.Rows[i].Cells["TitleColumn"].Value = title;
                        }
                    }
                    // JOEL JEFFERY 20110712 Hook up the UploadFailed event
                    // JON SILVER JULY 2011 Hook up the UploadSucceeded event
                    if (!addedEventHandler)
                    {
                        OutlookConnector.GetConnector(dragedFolder.SiteSetting).UploadFailed    += new EventHandler(EUEmailManager_UploadFailed);
                        OutlookConnector.GetConnector(dragedFolder.SiteSetting).UploadSucceeded += new EventHandler(EUEmailManager_UploadSucceeded);
                        addedEventHandler = true;
                    }

                    OutlookConnector.GetConnector(dragedFolder.SiteSetting).UploadFiles(dragedFolder, emailUploadFiles, fields, fieldInformations, listviewControl);
                }
                else
                {
                    uploadProgressForm.Initialize(dragedFolder, sourceFolder, emailUploadFiles, isListItemAndAttachmentMode, fieldInformations);
                    uploadProgressForm.ShowDialog();
                }
            }
            catch (System.Exception ex)
            {
                string methodName = System.Reflection.MethodBase.GetCurrentMethod().Name;
                LogManager.LogAndShowException(methodName, ex);
                throw ex;
            }
        }