Created
December 5, 2016 16:30
-
-
Save DroopyTersen/20b120aecca84c476ba5f89666b17b83 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var createChangeToken = function(date,listId) { | |
//Change token format: | |
// http://sharepoint.stackexchange.com/questions/194152/sharepoint-sharepoint-online-how-can-i-create-changetoken-without-using-msft-li | |
// The tricky part is the .NET ticks (micrsseconds since 1/1/1) | |
// Got the static number by running C#: | |
// (DateTime.MinValue.Subtract(new DateTime(1970, 1, 1))).TotalMilliseconds | |
// Add the static milliseconds since 1/1/1 to the JS milliseconds since 1/1/1970 | |
console.log(date); | |
console.log(new Date()); | |
var milliSecondsSince111 = 62135596800000 + date.getTime(); | |
// "Convert" to microseconds. No point actually doing math here though right? | |
var microseconds = milliSecondsSince111 + "0000"; | |
return { "StringValue": `1;3;${listId};${microseconds};-1`}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment