When requesting drives for a site for a particular tenant, I'm encountering an error that states the provided id is not suitable for the current host.
Here is the flow I am following:
1) Search for site and get its id:
https://graph.microsoft.com/v1.0/sites?search=portal4
Response:
{
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#sites",
"value": [
{
"createdDateTime": "2010-04-16T18:56:54Z",
"description": "Workspace for all internal volunteer projects",
"id": "seattleworks1org-portal4.sharepoint.com,2b7b00f7-987c-4b2a-b5e2-7a2b99c94d1d,22d63cbc-a320-44db-8c94-521b944203fe",
"lastModifiedDateTime": "0001-01-01T08:00:00Z",
"name": "seattleworks1org-portal4.sharepoint.com",
"webUrl": "https://seattleworks1org-portal4.sharepoint.com",
"root": {},
"siteCollection": {
"hostname": "seattleworks1org-portal4.sharepoint.com"
},
"displayName": "Capacity Building Volunteers"
}
]
}
client-request-id 鈫抎f6ae32c-ce9c-4741-8415-ae6d188c8520
request-id 鈫抎f6ae32c-ce9c-4741-8415-ae6d188c8520
x-ms-ags-diagnostic 鈫抺"ServerInfo":{"DataCenter":"East US","Slice":"SliceA","Ring":"5","ScaleUnit":"001","Host":"AGSFE_IN_23","ADSiteName":"EST"}}
md5-e9889bebe2aee58911da4b2a474f6a12
GET Request to:
https://graph.microsoft.com/v1.0/sites/seattleworks1org-portal4.sharepoint.com,2b7b00f7-987c-4b2a-b5e2-7a2b99c94d1d,22d63cbc-a320-44db-8c94-521b944203fe
md5-4aa4b88e9316cdafc82f54decc47987a
{
"error": {
"code": "invalidRequest",
"message": "Provided id is not suitable for the current host",
"innerError": {
"request-id": "ae9cb469-a0de-41fd-85b1-30eaca281d1b",
"date": "2018-02-01T14:39:11"
}
}
}
md5-1a993d355d491acb355e624e8886d1f8
client-request-id 鈫抋e9cb469-a0de-41fd-85b1-30eaca281d1b
request-id 鈫抋e9cb469-a0de-41fd-85b1-30eaca281d1b
x-ms-ags-diagnostic 鈫抺"ServerInfo":{"DataCenter":"East US","Slice":"SliceA","Ring":"2","ScaleUnit":"000","Host":"AGSFE_IN_1","ADSiteName":"EST"}}
I'm following docs here:
https://docs.microsoft.com/en-us/onedrive/developer/rest-api/api/site_get
Is this a data problem on the backend?
Hi @rloehr, this is unfortunately a limitation in Graph at the moment where they do not currently send requests to the correct endpoint. A /sites query will hit the default endpoint for the tenant, and so if the provided id is for a site on a different endpoint we'll get a failure like this. Work is being done to resolve this limitation.
@ificator Thanks a lot for sharing the information. We had been banging our heads against this issue for some time. Any idea when this issue will be resolved?
@rloehr were you able to find a way around to this issue for the moment? We have the same use case and can really use any help in finding a solution.
Seems like lot is hanging on how soon our good friend @kevklam can resolve this issue for us.
@MuhammadMobeen we don't have a workaround.
@ificator would this also allow access to OneDrive for Business personal sites? For example /sites/odb-my.sharepoint.com:/personal/some_user_onmicrosoft_com:/.
Is this still a known issue? I am trying to access a user's OneDrive for Business and I receive this error. The same code accessing a SharePoint file is fine.
This works now. An example request using ODB hostname and a site-path:
GET https://graph.microsoft.com/v1.0/sites/example-my.sharepoint.com:/personal/user_example_com:
{u'@odata.context': u'https://graph.microsoft.com/v1.0/$metadata#sites/$entity',
u'createdDateTime': u'2017-09-14T02:01:40.193Z',
u'description': u'This is the personal space of user test. You can use this space to create lists, document libraries to store, organize, and share information with others.',
u'displayName': u'changeme',
u'id': u'example-my.sharepoint.com,aa7e499f-602f-4d00-ab55-1b249936a1bb,11ef7be8-36ac-4060-8e26-4a52df9e4a5c',
u'lastModifiedDateTime': u'2019-02-23T03:23:59Z',
u'name': u'user_example_com',
u'root': {},
u'siteCollection': {u'hostname': u'example-my.sharepoint.com'},
u'webUrl': u'https://example-my.sharepoint.com/personal/user_example_com'}
Thanks for the feedback. Do you know if the .Net Graph SDK supports sending a URL like "example-my.sharepoint.com:/personal/user_example_com:"? I have been trying but can't figure out the syntax. I am trying with ItemWithPath. For example (not working):
var items = await graphClient.Groups["teamId/groupId"].Drive.Root .ItemWithPath("example-my.sharepoint.com:/personal/user_example_com:").Children.Request().GetAsync();
Sorry with that I can't help. Never used .Net Graph SDK.
Most helpful comment
@ificator Thanks a lot for sharing the information. We had been banging our heads against this issue for some time. Any idea when this issue will be resolved?
@rloehr were you able to find a way around to this issue for the moment? We have the same use case and can really use any help in finding a solution.
Seems like lot is hanging on how soon our good friend @kevklam can resolve this issue for us.