outlook - VBA "SendUsingAccount" for Meeting Request with Office365 Accounts -


i trying manage outlook calendar meetings through access 2016 db. schedulers in our office have own office 365 account in outlook default account second account called server@ use when scheduling field techs appointments. way field tech's meetings on server@ calendar , can separated schedulers calendar. have scoured web , tried every example code snippet copy, can't find way change "from" when sending meeting. have tried sendusingaccount no luck. uses office 365 email account signed in word sender (not sure technical term account). can change default account in outlook doesn't matter. ideas helpful.

function createcalendarentry(entrytype, calendar, startdate, starttime, apptduration, address, techin, notes, optional assistantin, optional resourcein)  ' find server@ email account number in outlook     dim serveraccountnumber integer     serveraccountnumber = findserveremail     if debugmode = true msgbox "account number:" & serveraccountnumber  'create subject line     dim subjecttemp string     dim techtemp string     subjecttemp = entrytype & " - " & address & ", " & techtemp  ' find techs email      techtemp = dlookup("[techemail]", "techs", "[id] = " & techin)  ' check if assistants , resources passed function.  add if were, add them temp.     dim assistanttemp string     dim resourcetemp string      if ismissing(assistantin) = false         if isnull(assistantin) = false             if debugmode = true msgbox "assistant sent calendar appointment function"             assistanttemp = dlookup("[techemail]", "techs", "[id] = " & assistantin)         end if     else         if debugmode = true msgbox "assistant not sent calendar appointment function"     end if      if ismissing(resourcein) = false         if isnull(resourcein) = false             if debugmode = true msgbox "resource sent calendar appointment function"             resourcetemp = dlookup("[truckname]", "truckstable", "[id] = " & resourcein)         end if     else         if debugmode = true msgbox "resource not sent calendar appointment function"     end if  ' use late binding avoid "reference" issue     dim olapp object ' outlook.application     dim olappt object ' olappointmentitem     dim attendees, resources outlook.recipient  'check see if outlook open     if isappthere("outlook.application") = false        ' outlook not open, create new instance        set olapp = createobject("outlook.application")     else        ' outlook open--use method        set olapp = getobject(, "outlook.application")     end if  'create appointment item , set type meeting     set olappt = olapp.createitem(1) ' olappointmentitem     olappt.meetingstatus = olmeeting  'add info appointment have used here, giving me issues     olappt.subject = subjecttemp     olappt.start = nz(startdate, "") & " " & nz(starttime, "")     olappt.duration = apptduration     olappt.location = nz(address, vbnullstring)     olappt.reminderset = false     olappt.responserequested = false     olappt.body = notes  'specify sender account     olappt.sendusingaccount = serveraccountnumber  'add recipients     set attendees = olappt.recipients.add(techtemp)         attendees.type = olrequired  'add resources if passed function     if isnull(resourcetemp) = true         set resources = olappt.recipients.add(resourcetemp)             resources.type = olrequired     end if  'send meeting request     olappt.send  'show meeting request if in debug mode     if debugmode = true olappt.display (true)  ' store calendarid in mileage can find later     olappt.mileage = olappt.globalappointmentid     olappt.save  ' display calendar id if in debug mode if debugmode = true msgbox "calendar id saved in mileage = " & (olappt.mileage)  'return mileage can later modify appointment     createcalendarentry = olappt.mileage  end function 


Comments

Popular posts from this blog

python Tkinter Capturing keyboard events save as one single string -

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

javascript - Z-index in d3.js -