public void _office_CreateWorkItem()
        {
            xl2vsoModel dataModel = new xl2vsoModel();
            dataModel.Title = "New work item 4";
            dataModel.ProjectName = "OExt";
            dataModel.AssignedTo = "Ashirvad Sahu";
            dataModel.AreaPath = @"OExt\Developer Experience and Analytics\Dev Exp\0-60 On Boarding";
            dataModel.IterationPath = @"OExt\Current";
            dataModel.Priority = 4;
            dataModel.CreatedBy = "Keyur Patel";
            dataModel.Description = "here is the description";
            dataModel.OriginalEstimate = 7;
            dataModel.WorkItemType = "Task";

            CreateWorkItem(dataModel);
        }
        public int CreateWorkItem(xl2vsoModel dataModel)
        {
            // No need to check param here, this will be checked by another function before calling this API
            var workItem = new WorkItem();
            //working
            workItem.Fields["System.Title"] = dataModel.Title;
            workItem.Fields["Microsoft.VSTS.Common.Priority"] = dataModel.Priority;
            workItem.Fields["System.AreaPath"] = dataModel.AreaPath;
            workItem.Fields["System.TeamProject"] = dataModel.Title;
            workItem.Fields["System.AssignedTo"] = dataModel.AssignedTo;
            workItem.Fields["System.Description"] = dataModel.Description;
            //workItem.Fields["Microsoft.VSTS.Scheduling.OriginalEstimate"] = dataModel.OriginalEstimate;
            workItem.Fields["Microsoft.VSTS.Scheduling.TargetDate"] = dataModel.TargetDate;

            workItem = _workItemClient.CreateWorkItem(VSOConfig.projectName, dataModel.WorkItemType, workItem).Result;
            return workItem.Id;
        }
        public xl2vsoModel ConvertToVSOModel(int rowIndex)
        {
            string rowStr = rowIndex.ToString();
            xl2vsoModel model = new xl2vsoModel();
            // B =id
            string range = 'B' + rowStr;
            Excel.Range row = activeWorksheet.get_Range(range);
            if (row.Value2 != null)
            {
                model.Id = row.Value2.ToString(); ;
            }

            // C =title
            model.Title = activeWorksheet.get_Range('C' + rowStr).Value2; ;

            // D =description
            var description = activeWorksheet.get_Range('D' + rowStr);
            if (description != null)
            {
                model.Description = description.Value2;
            }

            // E =assignedTo
            var assignedTo = activeWorksheet.get_Range('E' + rowStr);
            if (assignedTo != null)
            {
                model.AssignedTo = assignedTo.Value2;
            }

            // F = priority
            model.Priority = (int)activeWorksheet.get_Range('F' + rowStr).Value2;

            // G = workItemType
            model.WorkItemType = activeWorksheet.get_Range('G' + rowStr).Value2;

            // H = originalEstimate
            var estimate = activeWorksheet.get_Range('H' + rowStr);
            if (estimate != null)
            {
                model.OriginalEstimate = (int)estimate.Value2;
            }

            // I = StartDate
            var date = activeWorksheet.get_Range('I' + rowStr);
            if (date != null)
            {
                model.StartDate = date.Value2;
            }

            // K = TargetDate
            var targetDate = activeWorksheet.get_Range('J' + rowStr);
            if (date != null)
            {
                model.TargetDate = targetDate.Value2;
            }
            // K = areaPath
            model.AreaPath = activeWorksheet.get_Range('K' + rowStr).Value2;

            // L = iterationPath
            model.IterationPath = activeWorksheet.get_Range('L' + rowStr).Value2;

            // M = parentId
            var parentId = activeWorksheet.get_Range('M' + rowStr);
            if (parentId != null)
            {
                model.ParentID = (int)parentId.Value2;
            }

            // N = projectName
            model.ProjectName = activeWorksheet.get_Range('N' + rowStr).Value2;

            return model;
        }