You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Roxie Gibson 6fa69a424b
Changed the script to be better for inline config and running from the commandline.
4 years ago
seatingplan Changed the script to be better for inline config and running from the commandline. 4 years ago
.gitignore Moved the file so we can run it like a script and install it with pip 4 years ago
readme.md Changed the script to be better for inline config and running from the commandline. 4 years ago
setup.py Changed the script to be better for inline config and running from the commandline. 4 years ago

readme.md

Seating Plan Generator

Script to generate a seating plan via calendar events in an organsation’s Office365.

What it does

The script looks at the current week and generates a seating plan for that week. It will then create a csv to represent this. This is done using the default calendar of the user who allows the script access to their account. Note Current week is defined during the normal work weeks. If the script is ran on the weekend (Saturday and Sunday) the script will generate next weeks and label it as such.

Pre-Install

To setup the script, you will need to create an app in your organisation Azure Active Directory. You can find the app registration page here.

For a guide on how to do this, see the guide provided by python-o365 below.

To work with oauth you first need to register your application at Azure App Registrations.

  1. Login at Azure Portal (App Registrations)
  2. Create an app. Set a name.
  3. In Supported account types choose “Accounts in any organizational directory.
  4. Set the redirect uri (Web) to: https://login.microsoftonline.com/common/oauth2/nativeclient and click register. This is the default redirect uri used by this library, but you can use any other if you want.
  5. Write down the Application (client) ID AND Directory (tenant) ID. You will need these values.
  6. Under “Certificates & secrets”, generate a new client secret. Set the expiration preferably to never.
  7. Write down the value of the client secret created now. It will be hidden later on.
  8. Under Api Permissions add the delegated permissions for Microsoft Graph you want

The required Api Permissions are:

Calendars.Read.Shared
User.Read
User.ReadBasic.All
offline_access

Once the app has been created, git clone this repo, cd into it’s folder and install it into your user’s Python PATH.

git clone URL
cd seatplangen
python3 -m pip install . --user

Once installed, you can run the script like this.

seatingplan -c "CLIENT-ID" -t "TENANT-ID" -s "CLIENT-SECRET"

The first time the script is ran, it will ask you to visit a url. Open the url in your browser and allow the script access to the requested permissions. Once you have done that, you will be redirected to a blank page. Copy the URL and paste it into the console and press enter. Note You should give access AS the account who’s calendar is being used to store who’s out of office.

This will only need to be done every 90 days.