patternsqlMinor
can you use msdb.dbo.sp_send_dbmail to set up calendar appointments?
Viewed 0 times
canmsdbyoudboappointmentssp_send_dbmailusesetcalendar
Problem
For example, in health care, every employee gets a PPD test (they jab your arm with something) and you have to go back in 48 hours to see if you've sprouted an extra head.
Everybody forgets.
The nurses document in their EHR that they jabbed the patient, and I can send out an email reminding the employee to go check for their extra head, but I'd rather make it a calendar invite.
Question
How would you set up an outlook calendar appointment from SQL Server?
Everybody forgets.
The nurses document in their EHR that they jabbed the patient, and I can send out an email reminding the employee to go check for their extra head, but I'd rather make it a calendar invite.
Question
How would you set up an outlook calendar appointment from SQL Server?
Solution
(I dont have outlook to test it .. so the code is not tested by me)
Borrowed from : Send Outlook Calendar Requests in Email
Borrowed from : Send Outlook Calendar Requests in Email
EXEC msdb.dbo.sp_send_dbmail
@recipients =''
,@subject = 'iCalendar Example'
, @query = 'SET NOCOUNT ON;SELECT ''BEGIN:VCALENDAR''+ CHAR(13)+ ''VERSION:2.0''+ CHAR(13)+ ''METHOD:PUBLISH''+ CHAR(13)+ ''BEGIN:VEVENT''+ CHAR(13)+ ''CLASS:PUBLIC''+ CHAR(13)+ ''DESCRIPTION:This is the iCalendar example Most client application support it''+ CHAR(13)+ ''SUMMARY:iCalendar''+ CHAR(13)+ ''DTEND:20150325T110000''+ CHAR(13)+ ''DTSTART:20150325T120000''+ CHAR(13)+ ''LOCATION:My Office''+ CHAR(13)+ ''END:VEVENT''+ CHAR(13)+ ''END:VCALENDAR'''
, @attach_query_result_as_file = 1
, @query_result_header = 0
, @query_result_separator = 'CHAR(10)+CHAR(13)'
, @exclude_query_output = 1
, @query_attachment_filename = '123.ics'Code Snippets
EXEC msdb.dbo.sp_send_dbmail
@recipients ='<your email address>'
,@subject = 'iCalendar Example'
, @query = 'SET NOCOUNT ON;SELECT ''BEGIN:VCALENDAR''+ CHAR(13)+ ''VERSION:2.0''+ CHAR(13)+ ''METHOD:PUBLISH''+ CHAR(13)+ ''BEGIN:VEVENT''+ CHAR(13)+ ''CLASS:PUBLIC''+ CHAR(13)+ ''DESCRIPTION:This is the iCalendar example Most client application support it''+ CHAR(13)+ ''SUMMARY:iCalendar''+ CHAR(13)+ ''DTEND:20150325T110000''+ CHAR(13)+ ''DTSTART:20150325T120000''+ CHAR(13)+ ''LOCATION:My Office''+ CHAR(13)+ ''END:VEVENT''+ CHAR(13)+ ''END:VCALENDAR'''
, @attach_query_result_as_file = 1
, @query_result_header = 0
, @query_result_separator = 'CHAR(10)+CHAR(13)'
, @exclude_query_output = 1
, @query_attachment_filename = '123.ics'Context
StackExchange Database Administrators Q#212041, answer score: 6
Revisions (0)
No revisions yet.