如何将新列添加到包含任务类型元素的文件夹中(我想添加列“ project”,“ ID”)?如何将任务添加到特定文件夹,例如,添加到文件夹“ MyRedmineTasks”? 请帮忙。
我试图将任务添加到特定文件夹中,并在该文件夹中添加列。
Outlook.MAPIFolder inBox = (Outlook.MAPIFolder)
this.Application.ActiveExplorer().Session.GetDefaultFolder
(Outlook.OlDefaultFolders.olFolderTasks);
string userName = "Для Redmine16";
Outlook.MAPIFolder customFolder = null;
try
{
//add folder
customFolder = (Outlook.MAPIFolder)inBox.Folders.Add(userName,
Outlook.OlDefaultFolders.olFolderTasks);
//create a task item.Outlook.TaskItem newTaskItem =
(Outlook.TaskItem)Globals.ThisAddIn.
Application.CreateItem(Outlook.OlItemType.olTaskItem);
newTaskItem.StartDate = DateTime.Now.AddHours(2);
newTaskItem.Body = "MyTask";
newTaskItem.Save();
MessageBox.Show("You have created a new folder named " +userName + ".");
inBox.Folders[userName].Display();
//Create table in task folder
Outlook.TableView CurView =((Outlook.TableView)customFolder.CurrentView);
// remove columns
while (CurView.ViewFields.Count > 1)
{
CurView.ViewFields.Remove(1);
}
// re-add good columns
CurView.ViewFields.Add("Id");
CurView.ViewFields.Add("Priority");
CurView.ViewFields.Add("Status");
}
catch (Exception ex)
{
MessageBox.Show("The following error occurred: " + ex.Message);
}
//this code doesn't work
//Error: The field does not exist in this folder.