ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/ns_dev/Python/NinoCode/Tool_Box/OutlookLib.py
(Generate patch)

Comparing Python/NinoCode/Tool_Box/OutlookLib.py (file contents):
Revision 637 by nino.borges, Wed Mar 28 20:17:13 2018 UTC vs.
Revision 648 by nino.borges, Thu Dec 12 20:41:30 2019 UTC

# Line 15 | Line 15 | import win32com.client
15   class OutlookConnection:
16      def __init__(self):
17          self.outlookApp = win32com.client.Dispatch("Outlook.Application")
18 <        self.outlookEmailItem = 0x0
18 >        ## you dont have to make instance varibles from constants here.  It just looks a bit cleaner.
19 >        ## Before makepy, i had to map right to the 0x0. after makepy you can just ref a constant.
20 >        #self.outlookEmailItem = 0x0
21 >        self.outlookEmailItem = c.olMailItem
22 >        self.outlookAppointmentItem = c.olAppointmentItem
23 >        self.outlookMeeting = c.olMeeting
24 >        self.outlookTemplateType = c.olTemplate
25  
26      def DraftEmail(self, emailTO, emailCC, emailSubject, emailBody, emailAttachment = None, bodyType = 'HTML', finishType = 'Display', savePath = None):
27          """Easy way to draft an email and wont send if you allow finishType as Display.  Can be changed to OFT, to save it instead."""
# Line 23 | Line 29 | class OutlookConnection:
29          newEmailMessage.Subject = emailSubject
30          newEmailMessage.GetInspector
31          if bodyType == 'HTML':
32 <            newEmailMessage.HtmlBody = emailBody
32 >            newEmailMessage.HTMLBody = emailBody
33          else:
34              newEmailMessage.Body = emailBody
35          newEmailMessage.To = emailTO
36 <        newEmailMessage.Cc = emailCC
36 >        newEmailMessage.CC = emailCC
37          if emailAttachment:
38              newEmailMessage.Attachments.Add(Source=emailAttachment)
39          if finishType == 'OFT':
40              newEmailMessage.SaveAs(savePath)
41          else:
42              newEmailMessage.Display()
43 <        #newEmailMessage.send()
43 >        #newEmailMessage.send()
44 >
45 >    def DraftMeetingRequest(self, meetingRequired, meetingOptional, meetingSubject, meetingLocation, meetingBody, bodyType = 'HTML', finishType = 'Display', savePath = None):
46 >        """Easy way to draft a meeting request and wont send if you allow finishType as Display.  Can be changed to OFT, to save it instead."""
47 >        newMeetingInvite = self.outlookApp.CreateItem(self.outlookAppointmentItem)
48 >        newMeetingInvite.MeetingStatus = self.outlookMeeting
49 >        newMeetingInvite.Subject = meetingSubject
50 >        newMeetingInvite.Location = meetingLocation
51 >        #newMeetingInvite.Start = "7/24/2019 1:30:00 PM"
52 >        #newMeetingInvite.Duration = 90
53 >        if finishType == 'OFT':
54 >            newMeetingInvite.SaveAs(savePath, self.outlookTemplateType)
55 >        else:
56 >            newMeetingInvite.Display()

Diff Legend

Removed lines
+ Added lines
< Changed lines (old)
> Changed lines (new)