def __init__(self): dataDir = Settings.dataDir + 'ProgrammingOutlook/WorkingWithOutlookPersonalStorage/AddMapiTaskToPST/' task = MapiTask("To Do", "Just click and type to add task", Date(), Date()) task.setPercentComplete(20) task.setEstimatedEffort(2000) task.setActualEffort(20) mapiTaskHistory = MapiTaskHistory() task.setHistory(mapiTaskHistory.Assigned) task.setLastUpdate(Date()) task.getUsers().setOwner("Darius") task.getUsers().setLastAssigner("Harkness") task.getUsers().setLastDelegate("Harkness") mapiTaskOwnership = MapiTaskOwnership() task.getUsers().setOwnership(mapiTaskOwnership.AssignersCopy) personalStorage = PersonalStorage() fileFormatVersion = FileFormatVersion pst = personalStorage.create(dataDir + "TaskPST.pst", fileFormatVersion.Unicode) standardIpmFolder = StandardIpmFolder task_folder = pst.createPredefinedFolder("Tasks", standardIpmFolder.Tasks) task_folder.addMapiMessageItem(task) print "Added MapiTask Successfully.".PHP_EOL
def __init__(self): dataDir = Settings.dataDir + 'ProgrammingOutlook/WorkingWithOutlookMessageFiles/CreateOutlookTask/' contact = MapiContact() calendar = Calendar timeZone = TimeZone calendar = calendar.getInstance(timeZone.getTimeZone("GMT")) calendar.set(2012, calendar.NOVEMBER, 1, 0, 0, 0) startDate = calendar.getTime() calendar.set(2012, calendar.DECEMBER, 1) endDate = calendar.getTime() task = MapiTask("To Do", "Just click and type to add task", startDate, endDate) task.setPercentComplete(20) task.setEstimatedEffort(2000) task.setActualEffort(20) mapiTaskHistory = MapiTaskHistory() task.setHistory(mapiTaskHistory.Assigned) task.getUsers().setOwner("Darius") task.getUsers().setLastAssigner("Harkness") task.getUsers().setLastDelegate("Harkness") mapiTaskOwnership = MapiTaskOwnership() task.getUsers().setOwnership(mapiTaskOwnership.AssignersCopy) companies = ["company1", "company2", "company3"] task.setCompanies(companies) categories = ["category1", "category2", "category3"] task.setCategories(categories) task.setMileage("Some test mileage") task.setBilling("Test billing information") task.getUsers().setDelegator("Test Delegator") mapiSensitivity = MapiSensitivity task.setSensitivity(mapiSensitivity.Personal) mapiTaskStatus = MapiTaskStatus() task.setStatus(mapiTaskStatus.Complete) taskSaveFormat = TaskSaveFormat task.save(dataDir + "MapiTask.msg", taskSaveFormat.Msg) print "Created outlook task successfully."