Jump to content

Recommended Posts

Posted

Hello,

 

I've been working to find a way to opt out an email address from Teams weekly digest and have finally come up with a manageable solution that I thought I'd share.

 

We have SIMS for our MIS and Salamander Active Directory provisioning Teams Classes and Parent data via the Microsoft SDS sync. Salamander creates nightly uploads of the SDS csv file set and they offer this for free using their tool here...

https://www.salamandersoft.co.uk/free-utilities/salamander-for-school-data-sync/

 

This fix is for those that have an automated SDS sync upload rather than the free run-once option.

 

The problem:

A parent contacts the school to say that they do not want to receive the Microsoft Teams weekly digest email. You need to keep the email in the MIS for other systems. The Microsoft SDS already has the parent email address and it's only possible to remove the email from the Azure Active Directory by using the reset_guardians.ps1 script provided here:

https://github.com/OfficeDev/O365-EDU-Tools/blob/master/SDS%20Scripts/Reset-Guardians.ps1

Once you reset the guardian contacts for a student, all of the contacts are removed from the student, not just the one that wish to opt out. The other contacts for the student do not automatically reappear on the next csv file upload and it's only possible to get the contact data back again if you run a Full Sync reset on the SDS profile - something that cannot be automated (at the time of writing this).

Removing an individual is possible via PowerShell if you read into the script. You can adjust the contact array on the student object in the graph data to contain what you want manually or via a script. However that's not so easy for your admin/data/pastoral teams to manage themselves and would be an administrative headache for any IT Support Team.

 

A simple solution:

Rather than thinking about removing the parent from the student contacts on the Azure object, we can simply update the email address to a new value instead. The SDS sync process will push changes to values and add new values but will not remove them. So all we need to do is flag the contact in the MIS and have the process replace the email with a non existent one that will bounce. Simple!

 

For our setup we added a User Defined Field in SIMS in the Contacts data set. I called ours "NoTeamsEmail" and set it as a True/False type value. I then asked Salamander to add the new "NoTeamsEmail" UDF to the parent data extract, and use the value of the field to determine what the email address will be in the users.csv file creation workflow for SDS. The logic is that if the value of "NoTeamsEmail" field in SIMS is set to True (ticked) by the school's staff, Salamander will use a fixed value of "[email protected]" instead of the actual parent email address. SDS will then process this change when the files upload and the parent will no longer be receive the weekly email.

Note: The email address you choose should be at your own school domain or a domain that you control to ensure that it is never going to exist.

 

This works in any automation on SDS if you can identify the parent/guardian users somehow and just replace their email in the process if they are flagged.

 

Thank you to Salamander who have implemented this for us - developers changed their SDS process to accommodate it. Top marks :)

 

Thanks,

 

Chris

Posted

Or - add a ExcludeFromSDS User defined field to all people - contacts/students/staff

 

If ExcludeFromSDS is set, don't include in the csv file at all - that would save creating dummy emails addresses (which presumably creates emails to those dummy addresses), and would allow a student or member of staff (e.g. cleaner, or volunteer/governor if recorded on sims) not to be included in the sync.

Posted

I might ask Salamander to implement this for us as we've had one parent who insisted they didn't recieve these emails and I had to open a call with MS to do some Powershell magic to get the guardians removed from this pupil in SDS.

 

But I have another problem which am not sure doing this would fix, I have a kid who has 3 parents synced and this third parent who needs deleting will not remove from SDS. They are no longer linked in SIMS and the CSV's created by Salamander doesn't have said parent but they are still on SDS and linked to this pupil. Frustrating as the emails should not really be going to this person.

 

Any ideas before I open a call with Microsoft?

Posted (edited)

Hi,

 

It seems that uploading the new email address is adding an extra record for the same parent rather than overwriting it! Annoying!

 

Salamander can exclude parents with a UDF which be needed to prevent them uploading, however I was trying to automate the process by overwriting the existing email instead. It seems I am foiled by Microsoft SDS once again as it just adds another duplicate record! I will raise a ticket with MS support and see if they think it's a bug with the sync as I'm sure this worked in testing a month ago.

 

Please note: Microsoft do not remove addresses when they fall out of sync. You can exclude them to stop them going back in, but you have to run a powershell script to delete parent data. This is what I was trying to avoid!

 

The script is here...

https://github.com/OfficeDev/O365-EDU-Tools/blob/master/SDS%20Scripts/Reset-Guardians.ps1

 

You have to add a custom App Registration in Azure to get an API ClientID and ClientSecret for the script.

 

The data is in Graph and special permissions need granting for editing that. The permissions are below...

Capture.PNG

 

The script can remove all parents from one student, or all parents from ALL students. It does not remove one parent from one student as it is.

 

Here is how I currently call it:

 

# Set common params
$TenantDomain = "mydomain.uk"
$ClientID = "7jief9ej42-dfht-4444-5555-123456787tth"
$ClientSecret = "2Afrgh755gyh6PfgthuyfrthjuJLAM446hhr"

# Remove all guardians from one user
$student= Get-AzureADUser -ObjectId [email protected]
.\Reset-Guardians.ps1 -OutFolder . -clientId $ClientID -clientSecret $ClientSecret -tenantDomain $TenantDomain -studentAadObjectId $student.ObjectID

# Remove guardians from all users in the tenant
.\Reset-Guardians.ps1 -OutFolder . -clientId $ClientID -clientSecret $ClientSecret -tenantDomain $TenantDomain

 

You can strip out the data manually with the script and then use Salamander with a UDF so you can exclude the parent from the CSV uploads in SDS. Perhaps there is a way to automate the script as well. I have one idea where we ask Salamander to write an extra CSV with any of the opted out parents in it. We could then run the Reset-Guardians script against the contents of the opt out csv on a scheduled task.

 

If I figure this out I will update again.

 

Sorry!

 

Chris

Edited by cstreet
Posted
Or - add a ExcludeFromSDS User defined field to all people - contacts/students/staff

 

If ExcludeFromSDS is set, don't include in the csv file at all - that would save creating dummy emails addresses (which presumably creates emails to those dummy addresses), and would allow a student or member of staff (e.g. cleaner, or volunteer/governor if recorded on sims) not to be included in the sync.

 

SDS does not remove the data from Azure when a contact is excluded, this is the whole point of trying to overwrite the existing with a false one. I know it's not tidy, but neither is the guardian email data!

Update: Sadly however, it seems SDS doesn't overwrite the email and instead adds another duplicate parent instead :( Still working on a solution.

  • 2 months later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...