How to get Locale from userprofile information from TFS - tfs

How to get Locale from userprofile information from TFS? I couldnot find any information in MSDN and internet.

That's not documented, however you can track the API with third tools such as Fiddler or directly press F12 in Chrome.
You can use below REST API to get the user profile:
GET http://server:8080/tfs/DefaultCollection/_api/_common/GetUserProfile?__v=5
For the Locale information, seems we can only get the Language and Time zone by the "LCID" and "TimeZoneId" (Ctrl + F -> Enter the LCID or TimeZoneId to find out the locale info).
The Date pattern and Time pattern are not recorded in JSON response, the value is null for both of them.
See below example with the screenshot:
"TimeZoneId": "Central Asia Standard Time",
"LCID": 1033,

Related

Searching Microsoft Graph api with spaces in the name

I'm using Microsoft Graph to do a search on the displayName for a substring of the name. The $search="displayName:MySearchTerm" format works perfect. But trying to search on the displayName with a space in the term doesn't seem to work as expected.
Using the sandbox application here
https://developer.microsoft.com/en-us/graph/graph-explorer?request=groups?$expand=members&method=GET&version=v1.0
If I use the following query format:
https://graph.microsoft.com/v1.0/groups?$search="displayName:Product vi"&$select=displayName&$orderBy=displayName
how can I get it to return only those records that have the term Product vi in the displayName field.
It shouldn't return any records in the sandbox because the term Product vi does not appear exactly in any part of the displayName but it currently returns the record "displayName": "Video Production"
I've tried the following without success:
$search="displayName:"Product vi""
$search="displayName:\"Product vi\""
$search="displayName:\\"Product vi\\""
$search="displayName:\\\"Product vi\\\""
$search="displayName:'Product vi'"
$search="displayName:\'Product vi\'"
The $filter format is no good to me as it doesn't search the middle of the displayName for the string.
How do I format the url to get the desired results if it is even possible?
The trick is to use comma instead of the space in $search clause.
https://graph.microsoft.com/v1.0/groups?$search="displayName:Product,vi"&$select=displayName&$orderBy=displayName
If $search clause contains "displayName:Product,vi" then Graph API will search on displayName for "Product vi"
It can require a special request header:
ConsistencyLevel: eventual
Try with %22
instead of
%20
good code...

Dailymotion API - Search Restriction

I have a problem on video search. With a French IP, everything works well, but with Ireland IP no.
I try :
https://api.dailymotion.com/user/xm44zy/videos?search=RC%20Lens on French IP -> 500+ results
https://api.dailymotion.com/user/xm44zy/videos?search=RC%20Lens on Ireland IP -> 1 result
Maybe Video access error (DM007 Video geo-restricted by its owner) https://developer.dailymotion.com/api#access-error ?
No because https://api.dailymotion.com/video/x6f8qjq works well. Not found on search query (with Ireland IP) but I have access to the detail of the video
an idea ?
Thanks.
The API will always returns information about a specific video if you request data with its own resource URI (like: https://api.dailymotion.com/video/ID), even if the video is restricted in your country.
However, when using listings (i.e. asking for a video list, or when searching for videos based on search terms), the list will automatically exclude videos which can't be played in your country.
You can know if a video is geoblocked in your country using the "geoblocking" field:
https://developer.dailymotion.com/api/internal#video-geoblocking-field.
In your case, your example is geo-restricted everywhere else France, that's why it won't show in search results (or any listings): https://api.dailymotion.com/video/x6f8qjq?fields=id,title,geoblocking
returns: "geoblocking": [
"allow",
"fr"
]
This means you can only watch it ( and appears in search results ) in France

microsoft graph createreply wrong timezone

In our Angular 5 application, we are using Microsoft Graph to retrieve mail messages from a mailbox and then send a reply. For creating the reply, we use the REST API:
https://graph.microsoft.com/v1.0/me/messages/{message ID}/createReply
This creates a reply with a timezone that is UTC, but we expect it to be GMT+1. For example, in the mail body it says:
From: Melissa van Dijk
Sent: Friday, February 23, 2018 9:51:49 AM (wrong timestamp)
To: Melissa van Dijk
Subject: Meet for lunch?
We checked the settings in our Office 365 mail account and there it is specified that our local timezone is GMT+1 (Brussels, Amsterdam...).
(When replying via Outlook webmail, we get a correct timestamp).
Is this a bug or do we have to correct this timestamp ourselves? Or do we need to pass the timezone with the REST call somehow?
Thanks in advance!
I'm not sure if you can adjust the human-formatted timestamps in the HTML message body, but you can certainly use the ISO 8601 formatted timestamps in the other fields in the JSON of the response. For example, you'll find:
{
...
"sentDateTime": "2018-02-23T09:51:49Z",
...
}
While this is also in UTC (denoted by the Z), you can easily parse it by using a JavaScript Date object, or Angular's own datetime functions, or your favorite time library such as Luxon, Moment, or Date-fns. From there, displaying it in local time is trivial.

What does "ei" mean in the Google homepage url https://www.google.co.in/?gws_rd=cr&ei=xgH...?

I know about some of the parameters in a google url, such as:
gws =google web server
rd = redirected
cr = country reffered
But I noticed one I cannot identify: &ei=. What does the ei mean in this URL?
http://www.google.co.in/url?ei=qWwlUqD4MIrRrQfD9ICIDw&...etc...
The ei parameter contains a timestamp—probably with microseconds—which corresponds to the time when the search results were served.
Your particular ei value (qWwlUqD4MIrRrQfD9ICIDw) contains the following values:
Array
(
[0] => 1378184361
[1] => 801824
[2] => 15427722
[3] => 4043323971
)
The timestamp (1378184361) corresponds to 03/09/2013 05.59.21.
The microseconds are 801824 (probably).
(Unfortunately no-one is going to be able to confirm whether they are microseconds or not, but the timestamp (in seconds) is obvious.)
See this guide to decoding ei values, which also provides an open-source PHP function.
You must have used the wrong search terms. A quick search for: google parameter +"ei=" turned up this blog entry which says the ei= parameter:
Passes on an alphanumeric parameter that decodes the originating SERP
where user clicked on a related search...

Prevent JsonResult from auto-formatting Dates

I'm writing a cloud based program that utilizes UTC for date saving to the server, and convert it back on the round trip. Problem is, my instance in the cloud is autoconverting the JsonResult datetime values according to the localization settings on the browser obtaining the result.
I have gone through tons of steps to make sure the server side code on both levels is returning the proper data, and it is on all instances, and no Javascript code on my page is making the change either (even removed all my Javascript date formatting just in case), I have traced out with Firebug to determine the exact point that it changes, is when my page receives the Json Result from my JsonResult method. Like I said, I have debugged the values before being sent to the page, and they are proper, and on my response, they are modified based upon browser location....
Has anyone had a similar problem?
Value returned:Date(1341792000000) 07/08/2012 17:00
Should be: Date(1341817200000) (07/09/2012 12:00AM)
Thanks
I finally ended up getting the proper results, with many modifications to my application. I did a lot of stuff to make this happen... First, I implemented timezone.JS to get a listing of timezones that will be used within the application, and used jstz to get current timezone of browser loading the page. Next, I have to make (for mvc) an file get method that accesses the timezones to load into timezoneJS.
Next, on save of the timezone, I specified pst as the type, and then convert back to utc on roundtrip to update the interface.
On formatting of my Json date, I run the timezoneJS method and get the timezone name from jstz, and set the new date value like such:
var timezone = jstz.determine();
timezoneJS.timezone.zoneFileBasePath = '/Item/GetTz'; // get file method
var dt = new timezoneJS.Date(parseInt(jsonDate.substr(6), timezone.name())); // strips out date from json date
dt.setTimezone('America/Los_Angeles');
This allows on the cloud projects to be ran on any server, and displayed in any browser regardless of timezone, and allow the user to view and configure timezone sensitive data natively, and allow for users to see the start/end date of configurable database values.
Maybe using http://msdn.microsoft.com/en-us/library/system.datetime.specifykind.aspx
Did you try with,
date.toLocaleString()
Alternatively,
You can create a new Date object and use Date.setUTC
As the OP said:
Problem is, my instance in the cloud is autoconverting the JsonResult datetime values according to the localization settings on the browser obtaining the result.
Recently experienced something similar. Strange behavior coming from $.ajax response. Depending on the language setting of the browser, a date received in string format gets converted into whatever is set in the language setting.
For example, in Postman, Web API response is like so:
{
"id": "10057",
"d_date": "3/30/2017 3:00:00 AM",
"sum": 253.0
},
If the browser is set to english(en/en-us), response is the same as above.
If the browser is set to english-uk(en-gb), response becomes:
{
"id": "10057",
"d_date": "30/03/2017 03:00:00",
"sum": 253
}
If the browser is set to german(de), response becomes:
{
"id": "10057",
"d_date": "30.03.2017 03:00:00",
"sum": 253
}
So somehow, the browser or the $.ajax library is trying to be smart and formatting the dates automatically.
Probably, the best solution is that the Web API send the date in ISO date time format.
Another solution if you can't change the backend is to add accept-language: en in the AJAX header request. Something like so:
$.ajax({
type: 'POST',
url: '/endpoint/',
contentType: 'application/json',
data: JSON.stringify(body),
dataType: 'json',
async: false,
headers: {
'accept-language': 'en'
}
})

Resources