Microsoft Graph for OneDrive Throttling Issue - RetryAfter Property is null - microsoft-graph-api

We use Microsoft Graph.dll (version 1.2.1) and Microsoft.Graph.Core.dll (version 1.3.1) to extract OneDrive folder and file information (with permissions). We have been doing this successfully for over a year. When doing this we are sometimes throttled. When this happens an exception is thrown of type "Microsoft.Graph.ServiceException". This has a status code. If the status code is 429 then we know we have been throttled and we can examine the response headers in the exception to extract the required "RetryAfter" period. I believe normally the RetryPeriod is 4000ms. We have, however, just recently begun begun to see null returned in this property - which seems incorrect, we don't believe we have seen it before.
Has anybody else seen this and/or have a workaround? Has something changed....?
Many thanks ....

That does sound unexpected. I will follow up and see if something has changed. I suggest that you implement a progressive retry routine if the retryafter header is not present on a 429 or 503.
While on the topic on RetryAfter, we've implemented this in the client library (see the PR). You'll have an out of box way to do this.

Related

Outlook REST API Flagging Message losing start date

I'm building an Outlook Add-In and using the Outlook REST API 2.0. When updating a mail message to flag the message for follow-up, the update is accepted and in the Outlook Web client it briefly shows the start and due dates, but within a few seconds the start date goes away. When looking at the message through the API, the start date is completely removed, even though it was successfully added.
The API is PATCH Office.context.mailbox.restUrl + '/v2.0/me/messages/' + messageId ...
EDIT: I confirmed that this same behavior is exhibited in the Graph API as well.
As soon as the API is called, the UI on the message is updated:
Shortly after that (sometimes within a second, sometimes a little longer), the UI changes to:
And once the UI updates, if you query the API for the message and look at the Flag property, the StartDateTime object is completely gone.
Has anyone seen this or know why it might be happening?
Checked it on Graph with the following payload for PATCH-Message call and it seems to be working fine.
{"flag":{"dueDateTime":{"dateTime":"2020-08-20T00:00:00.0000000","timeZone":"Asia/Kolkata"},"flagStatus":"flagged","startDateTime":{"dateTime":"2020-08-14T00:00:00.0000000","timeZone":"Asia/Kolkata"}}}
I suspect that there is another application/outlook add-in that's removing this flag. Can you check once?

Microsoft Graph API for Education: error listing user schools

I'm trying to retrieve the educationShool list of an educationUser from Microsoft Graph per the API reference:
I am getting this error:
Error message: The request URI is not valid. Since the segment
'memberOf' refers to a collection, this must be the last segment in
the request URI or it must be followed by an function or action that
can be bound to it otherwise all intermediate segments must refer to a
single resource.
I have reproduced this issue in the Graph Explorer, if I try to send this request, I get the same error:
https://graph.microsoft.com/v1.0/education/me/schools
If I try to list the Classes (I think it should be a very similar scenario), it works ok:
https://graph.microsoft.com/v1.0/education/me/classes
Am I doing something wrong, or is this a bug in the API?
I was able to reproduce this and it looks like there may be a bug here. While that gets investigated, I can confirm that it works properly in the /beta release:
https://graph.microsoft.com/v1.0/education/me/schools
I'd suggest using /beta for this particular call if possible.
Update: This issue has been resolved and education/{users}/schools should now be working in both v1.0 and Beta versions.

Http error code for dependent modules

I am working on plugins for a web platform.
I have one Core plugin(core library which is required to be installed and enabled) and one functional plugin.
I want when Core plugin is installed but not enabled then the functional plugin not to work. I've always check whether the Core is enabled and want to return it for all kind of requests - json, xml, html, ...
I want to return to the client response with good error code but not sure which one is the best.
I am thinking about 403 or as most people do 500.
Any suggestions?
Regards,
Boris
The returned code you should use really depends on semantics of the resource state. The answers to these questions should determine appropriate status code:
Why the Core is disabled? Is it an error state (something unexpected, that should not happen under normal conditions) or normal state?
Is the service disabled for all clients or some authorized users could perform the calls?
Should the client treat current state as temporary or permanent?
Here are some suitable error codes (under certain conditions):
403 Forbidden
You should use this code only if some of the users still could call the service successfully.
500 Internal Server Error
This generic error code is far too overloaded. Choose it only if you can't select more specific error code.
503 Service Unavailable
It's a good candidate if current state is temporary and should be fixed soon.

TFS2012 Adapting Bug Item WIT

While I was following the guide http://msdn.microsoft.com/en-us/library/vstudio/jj920163.aspx to add Bugs to the task board I ran into an unexpected issue.
Adding the fields to the WIT was successful but when I started adding the form fields I received a very strange error:
Failed to save the 'Bug' Work Item Type to the server. Please contact
your administrator. There was an error contacting the server.
Technical information (for administrator): HTTP code 200: OK
Now I played around trying to find what field was causing the error... I tried every field seperatly and when added seperately they worked, then I tried adding them in pairs, this worked as well, then I tried adding all of them and even this worked!
BUT: When I try to add all of them in a clean group and column I get the error!
This leads me to believe there is some sort of maximum amount of elements in the layout form of a WIT? For now we have left all the fields added to another category but I wanted to ask if someone else had run into this issue and if there is a solution for this?
Since these are all stored as columns in a SQL Server table, the maximum you can add is 1024 (less the TFS standard, which might be around 33 columns?)
If you think this is the problem, check the Tfs_Warehouse..DimWorkItem table and see if you exceed the maximum.
Any chance you can get more information from the event viewer log on the app server, or provide more information about your bug? That message isn't very useful.
For reference -
http://blogs.msdn.com/b/eugenez/archive/2009/05/07/work-item-customization-tidbits-limits-of-complexity-part-13-of-x.aspx
Today we figured out what was going on by using fiddler and more closely monitoring the exchange between Visual Studio and our TFS server. Apparently the request was hitting the Application Firewall that was installed on the TFS server. This is the reason why you receive the vague error HTTP code 200: OK. The Application Firewall replies with a plain HTML page containing a blocked request ID (so you can pass it to your system admin). Once we passed this ID on to our networking team and they adapted the rules there was no longer an issue.
I hope this helps anyone who unexpectedly runs into an Application Firewall on your TFS server like I did.

Twitter4j: getting inconcistent authentication errors when invoking getFollowersIDs

I am using Twitter4j version 3.0.3.
I am trying to pull follower id and using OAuth. I have been using Twitter4j for years and am relatively experienced with the framework.
However something strange is happening: My program will run fine and then intermittently throw the following stack trace:
Exception in thread "main" 401:Authentication credentials (https://dev.twitter.com/pages/auth) were missing or incorrect. Ensure that you have set valid consumer key/secret, access token/secret, and the system clock is in sync.
{"request":"\/1.1\/followers\/ids.json?user_id=20801287&cursor=-1&include_entities=1&include_rts=1","error":"Not authorized"}
Relevant discussions can be found on the Internet at:
http://www.google.co.jp/search?q=92c30ec6 or
http://www.google.co.jp/search?q=19400604
TwitterException{exceptionCode=[92c30ec6-19400604], statusCode=401, message=null, code=-1, retryAfter=-1, rateLimitStatus=RateLimitStatusJSONImpl{remaining=6, limit=15, resetTimeInSeconds=1362898120, secondsUntilReset=890}, version=3.0.3}
at twitter4j.internal.http.HttpClientImpl.request(HttpClientImpl.java:177)
at twitter4j.internal.http.HttpClientWrapper.request(HttpClientWrapper.java:61)
at twitter4j.internal.http.HttpClientWrapper.get(HttpClientWrapper.java:89)
at twitter4j.TwitterImpl.get(TwitterImpl.java:1817)
at twitter4j.TwitterImpl.getFollowersIDs(TwitterImpl.java:400)
It throws the above at the following line:
IDs ids= twitter.getFollowersIDs(id,cursor);
The above line executes just fine and then without warning fails.
Note: I am checking rate limits and the last time I encountered this the rate limit JSON object pulled by the following line was (below):
RateLimitStatus rls=twitter.getRateLimitStatus().get("/followers/ids")
RateLimitStatusJSONImpl{remaining=7, limit=15, resetTimeInSeconds=1362898120, secondsUntilReset=890}
I thought this might have been an intermittent thing with Twitter, but it has been going on for a few days now.
I've tried it from various machines but get exactly the same problem.
The call fails in this manner, once in approximately 20 calls.
I have also read the similar questions on SE:
Twitter4j 401 Authentication -- However, this is a case where OAuth was not working -- in my case it seems to be working fine until of course when it doesn't.
twitter4j: getting credential errors even though i had set them? -- again not much here that is similar to my case.
Problem in Oauth with twitter4j -- suggest registering the app as a web-app, which I've done, I've filling in the callback url (though it does nothing), but still no luck.
The exception seems to be caused by ids of twitter profiles that may be private.

Resources