Configuration¶
1. Custom Limeobject Todo¶
There is some code that needs to be added to the todo's custom limeobject. Generate the limeobject if it's not already in the solution.
from lime_type.limeobjects import LimeObject
# TODO: Add these lines at the top of the file
from limepkg_save_todo_to_ews_outlook import ews, errors
import limepkg_save_todo_to_ews_outlook.behaviours as booking_behaviours
# TODO: Add this in before_update and before_delete in the custom limeobject class of Todo
class Todo(LimeObject):
def before_update(self, uow, **kwargs):
super().before_update(uow, **kwargs)
app = self.application
if booking_behaviours.update_booking:
try:
exws = ews.ExchangeWebservice(
booking_behaviours.get_ews_config(app)
)
booking_behaviours.handle_ews_booking(self, exws)
except errors.EwsError as e:
logger.warning(f'Failed to handle outlook booking: {str(e)}')
def before_delete(self, uow, **kwargs):
super().before_delete(uow, **kwargs)
app = self.application
if booking_behaviours.update_booking:
try:
exws = ews.ExchangeWebservice(
booking_behaviours.get_ews_config(app)
)
booking_behaviours.handle_ews_booking(self, exws)
except errors.EwsError as e:
logger.warning(f'Failed to handle outlook booking: {str(e)}')
def register_limeobject_classes(register_class):
register_class("todo", Todo)
2. LISA¶
Create 2 fields on the todo-card:¶
- A
yes/no
field and name itsend_to_ews
- A
text
field and name itews_id
. Set the length to 256 and make it invisible
3. Application configuration¶
We need to add application configuration so that the integration towards Outlook will work.
-
On prem:
- Add it to the application_config.yaml file
-
Cloud:
- Add it to the app config in CAFE
This is where we need the credentials from the customer's Enterprise Application.
Add the following to your config:
limepkg_save_todo_to_ews_outlook:
exchange:
server_address: 'outlook.office365.com'
authentication:
type: 'OAUTH2'
BASIC:
username: ''
password: ''
OAUTH2:
client_id: 'credentials from customers Enterprise Application'
client_secret: 'credentials from customers Enterprise Application'
tenant_id: 'credentials from customers Enterprise Application'
NTLM:
username: ''
password: ''