Subscribing to presence in MS Graph API for multiple users - microsoft-graph-api

I am currently trying to retrieve Teams presence information via MS Graph API SDK (Beta). Everything is working smoothly when just subscribing for some users. As soon as the number of users gets larger, problems are starting. I hope someone can clarify things:
Basically I am doing it like mentioned here:
Subscription = Client.Subscriptions.Request().AddAsync(new Subscription
{
Resource = $"/communications/presences?$filter=id in ('<guid>','<guid>',...))",
ChangeType = "updated",
...
}).Result
Issue 1: Two subscriptions, one user/presence on each
After everything was working, I tried to create multiple subscriptions. In my test case two subscriptions with a single contact on each. Trying to create a second subscription does not work with the error "Operation: Create; Exception: [Status Code: Conflict; Reason: A subscription already exists. It must be deleted before a another can be made.]"
I am now wondering whether I am doing something wrong or if this is a limitation (haven't found anything in the docs).
I hope I am doing something wrong as the goal would be to monitor even more then the 650 users mentioned in the linked article above. The error I get:
Code: ExtensionError
Message: Operation: Create; Exception: [Status Code: Conflict; Reason: A subscripton already exists. It must be deleted before a another can be made.]
Inner error:
AdditionalData:
date: 2020-11-08T20:47:37
request-id: 9d45a16b-9cac-4515-92f9-b81b36318189
client-request-id: 9d45a16b-9cac-4515-92f9-b81b36318189
ClientRequestId: 9d45a16b-9cac-4515-92f9-b81b36318189
Issue 2: One subscription, multiple users/presences
Afterwards I tried to create a single subscription with more than my three test users, which sadly did also not work as expected:
250 Users/presences
Code: ExtensionError
Message: Operation: Create; Exception: [A task was canceled.]
Inner error:
AdditionalData:
date: 2020-11-08T20:38:30
request-id: c6398df3-c856-4f80-9495-0b76714d9592
client-request-id: c6398df3-c856-4f80-9495-0b76714d9592
ClientRequestId: c6398df3-c856-4f80-9495-0b76714d9592
350 Users/presences
Code: ExtensionError
Message: Operation: Create; Exception: [Status Code: BadRequest; Reason: ]
Inner error:
AdditionalData:
date: 2020-11-08T20:40:45
request-id: 297f7b7d-e2d7-4ad4-8083-cc4797415287
client-request-id: 297f7b7d-e2d7-4ad4-8083-cc4797415287
ClientRequestId: 297f7b7d-e2d7-4ad4-8083-cc4797415287
650 Users/presences
Code: UnknownError
Message: The page was not displayed because the request entity is too large.
Inner error:
AdditionalData:
date: 2020-11-08T20:35:28
request-id: b3580f44-dcec-4fdc-87e2-50ae92da8bd3
client-request-id: b3580f44-dcec-4fdc-87e2-50ae92da8bd3
ClientRequestId: b3580f44-dcec-4fdc-87e2-50ae92da8bd3
Does anyone have an idea what is going wrong here?
Any information would be helpful.

When we try to add more subscriptions then we get conflict error "A subscription already exists. It must be deleted before a another can be made", because it supports only one subscription.

Related

ExactOnline: Token is not allowed, because of invalid or empty chainId

We have a java application that connects to ExactOnline for performing the operations.
The connection works fine for almost 9days and then it will start complaining about the below exception:
"Request from start.exactonline.nl returned an error (response code: 400, response: { "error":"invalid_grant","error_description":"Token is not allowed, because of invalid or empty chainId"
After encountering this error we have to force re-authorize the application by the user to get the new accessToken.
Now I am getting the below error as well:
"Request to token endpoint https://start.exactonline.nl/api/oauth2/token"
Any help would be appreciated.
The error message it's background and the solutions are explained at https://forums.invantive.com/t/exact-online-error-token-is-not-allowed-because-of-invalid-or-empty-chainid-on-exact-online/2226

com.microsoft.graph.http.GraphServiceException: Error code: SyncStateInvalid

com.microsoft.graph.http.GraphServiceException: Error code: SyncStateInvalid
Error message: The sync state identified using the request token 'HzWyBB6EZsMOpd9NmgmVnqAnVEMAAAQ9rM8FAwAA' is no longer valid.
GET https://graph.microsoft.com/v1.0/users/6be2c2df-8e20-4f99/mailFolders/AQMkADlmY2YxNTY3LWVhNjItNDFhMS1iZDA0LWZ/messages/microsoft.graph.delta?$deltatoken=LztZwWjo5IivWBhyxw5rAHNeTrUj6tmJCwsicW9zTkZhNFWO0u7VKvvdkBxQHWUvDsSPLMpUBSlb3nEcc_qVbTk1hQlWa3MIyqHvnT47wRA.NIA-bd_JnbZrpOuTHnjHoWWo1K5QPy4CLrFTODjYn9c
Prefer : odata.maxpagesize=1
Prefer : IdType="ImmutableId"
SdkVersion : graph-java/v1.6.0
Authorization : Bearer eyJ0eXAiOiJKV1QiLCJub25jZSI[...]
Hi guys, I'm getting the above SyncStateInvalid error, I've done a search, realizing that most people are facing SyncStateNotFound error instead.
Not sure if anyone faces this issue before and knows what is the fix.
I am trying to sync incremental mail messages based on the delta token.
I've tried to paste the same link in graph explorer, and was able to get result.

InternalServerError after Consecutive Uploads

I'm trying to upload multiple files to a client's SharePoint using separate calls to the following endpoint
https://graph.microsoft.com:443/v1.0/drives/{drive-id}/root:/{itemId}:/microsoft.graph.createUploadSession.
An average of fifty files upload successfully, but eventually I receive the following error.
Error = {
Code: generalException
Message: An unspecified error has occurred.
Inner Exception: {
Additional Data: {[
{[request-id, 34068a5e-41ac-4009-814a-f085f7e03443]},
{[date, {1/23/2020 3:59:27 PM}]}
]}
}
}
Below is the received response header
{
request-id: 34068a5e-41ac-4009-814a-f085f7e03443
client-request-id: 34068a5e-41ac-4009-814a-f085f7e03443
x-ms-ags-diagnostic: {
"ServerInfo":{
"DataCenter":"South Central US",
"Slice":"SliceC",
"Ring":"4",
"ScaleUnit":"002",
"RoleInstance":"AGSFE_IN_5"
}
}
Strict-Transport-Security: max-age=31536000
Cache-Control: private
Date: Thu, 23 Jan 2020 15:59:27 GMT
}
I don't think our application is being throttled since we're not receiving a 429 response. I also don't believe it is a file size issue as the files are under 4MBs
In the end, the issue was related to a space at the end of a folder name within our path.
We were constructing paths based on user named entities and were failing to trim them before uploading to Sharepoint. Oddly, we were allowed to upload one file to the Sharepoint which seemed to trim the elements of the path accordingly, but the second file uploaded would always throw the above error.

Microsoft.SharePoint.Client.UnknownError when listing Drives for a SharePoint site

When attempting to the list the drives for a SharePoint site, I recently began receiving a Microsoft.SharePoint.Client.UnknownError response.
The request and response is as follows:
Request:
https://graph.microsoft.com/v1.0/sites/<site_id>/drives?select=*,system
Response:
request-id: 050894cc-a435-498a-ae0a-ead3d46924f9
client-request-id: 050894cc-a435-498a-ae0a-ead3d46924f9
x-ms-ags-diagnostic: {"ServerInfo":{"DataCenter":"East US","Slice":"SliceB","Ring":"NA","ScaleUnit":"000","Host":"AGSFE_IN_21","ADSiteName":"EST"}}
{
"error":{
"code":"-1, Microsoft.SharePoint.Client.UnknownError",
"message":"Unknown Error",
"innerError":{
"request-id":"050894cc-a435-498a-ae0a-ead3d46924f9",
"date":"2017-12-06T12:38:44"
}
}
}
The same call was working earlier this week without any changes on my end.
I found a few posts from about a month ago that indicate this is possibly a regression on the MS side of things.
Microsoft Graph Exception code -1 starting this week
Microsoft Graph API for SharePoint in Python: Microsoft.SharePoint.Client.UnknownError
MS Graph API Unknown Error when trying to get folder's children
Is this a indeed a regression on the MS side? Is it a change in API behavior that I need to adjust for?
This was indeed a regression that hit a limited number of scenarios. We've since fixed it so you shouldn't see the unexpected behavior any more.

YouTube API v3.0 CommentsThread.list proccessing failuer issue

When I send a comments thread. List request to the YouTube API
I get the following exception "But not for all videos":
Google.GoogleApiException: Google.Apis.Requests.RequestError
The API server failed to successfully process the request.
While this can be a transient error, it usually indicates that the requests input is invalid. Check the structure of the commentThread resource in the request body to ensure that it is valid. [400].
And for those videos I double checked the inputs sent with the request and I
make the request with the same data directly from the YouTube API requests trial section but everything goes right!
I want to know why this request becomes valid on some video ID's but invalid on the others ?
I'll appreciate any help.
Here is the full written log: System.AggregateException: One or more errors occurred. ---> Google.GoogleApiException: Google.Apis.Requests.RequestError
The API server failed to successfully process the request. While this can be a transient error, it usually indicates that the requests input is invalid. Check the structure of the commentThread resource in the request body to ensure that it is valid. [400]
Errors [
Message[The API server failed to successfully process the request. While this can be a transient error, it usually indicates that the requests input is invalid. Check the structure of the commentThread resource in the request body to ensure that it is valid.] Location[body - other] Reason[processingFailure] Domain[youtube.commentThread]
]
at Microsoft.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at Microsoft.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccess(Task task)
at Google.Apis.Requests.ClientServiceRequest`1.d__0.MoveNext() in c:\ApiaryDotnet\default\Src\GoogleApis\Apis\Requests\ClientServiceRequest.cs:line 0
--- End of inner exception stack trace ---
CommentThreads.list API doesn't need a request body as indicated in the API reference
Request body
Do not provide a request body when calling this method.
This may have caused the RequestError on your call. Try to remove any objects passed when calling this API, hopefully this would fix the issue.

Resources