Skip to content

Instantly share code, notes, and snippets.

@wilwang
wilwang / automapper_timezone_sample.cs
Last active March 7, 2019 15:21
Automapper to do datetime conversions
/******
An example to automatically perform datetime conversions using automapper
Assumptions:
* all inputs are in client Local time (MyInputModel)
* all datetimes are stored as UTC (MyDto)
* all datetimes retrieved from storage are in UTC and contain the destination timezone (MyDto)
* if destination not supplied, use the server local time zone
*******/
@wilwang
wilwang / gist:d494fe7cb6a156b93157d06a83b9f771
Created October 29, 2019 13:46
Generating access_token to SPO
1. Create an app registration in Azure Active Directory (Can also create from SPO using _layouts/15/appregnew.aspx)
a. Under "Authentication", make sure implicit grants are all checked (access tokens and id tokens)
b. Under "Certificates & secrets", create a secret (jot it down!)
c. Under "API permissions", add SharePoint appropriate permissions
2. Go to SPO instance app inventory: https://<tenant>.sharepoint.com/_layouts/15/appinv.aspx
a. UNKONWN: in order to create the app registration on SPO, a secret is required. For some reason, the secret created in the previous
step (1b) is not the correct format. I've generated a secret and re-created a secret using 1b. I THINK, both secrets would work,
but in my test case, i ended up using the 2nd secret I created under 1b.
b. Fill in details and add permissions xml (https://docs.microsoft.com/en-us/sharepoint/dev/solution-guidance/security-apponly-azureacs)