Как добавить новые столбцы в папку, содержащую элементы типа задачи?Как я могу добавить задачи в определенную папку? - PullRequest
0 голосов
/ 20 апреля 2019

Как добавить новые столбцы в папку, содержащую элементы типа задачи (я хочу добавить столбцы «проект», «идентификатор»)? Как я могу добавить задачи в определенную папку, например, в папку «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.
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...