Can we access specific cell values from multiple ranges using a single Microsoft Graph request?
For example:
https://graph.microsoft.com/v1.0/me/drive/items/{file-id}/workbook/worksheets('{id}')/Range(address='e10:e11,c58:c59')
If I request only one range then I am getting the expected result. If I use the query above to get two specific ranges is not working:
"error": {
"code": "InvalidArgument",
"message": "The argument is invalid or missing or has an incorrect format.",
"innerError": {
"request-id": "1d3d0a3c-cf6f-4f0c-8e84-c65ff80cd020",
"date": "2017-07-25T14:13:11"
}
}
I suspect you're attempting to use Graph in the same way VBA can be used to refer to multiple ranges (i.e. Worksheets("Sheet1").Range("C5:D9,G9:H16,B14:D18")). This isn't model isn't supported by Graph.
Instead you'll need to pull each range using a separate GET request:
GET workbook/worksheets/Sheet1/range(address='e10:e11')
GET workbook/worksheets/Sheet1/range(address='c58:c59')
Related
According to the MS Graph API documentation, businessPhones are supported to be used in a $filter query with eq comparison, just like the imAddresses property.
When inspecting Microsoft's use query parameters documentation, there's an example where the imAddresses property is used in a collection filter and it works just fine.
GET https://graph.microsoft.com/v1.0/users?$filter=imAddresses/any(s:s eq 'admin#contoso.com')
My goal ist to list all users that have a specific phone number in their businessPhones collection property.
However, when I try to use the businessPhones property in a similar query, the query does not work as expected.
GET https://graph.microsoft.com/v1.0/users?$filter=businessPhones/any(s:s eq '1234')
Status code: 400
{
"error": {
"code": "Request_UnsupportedQuery",
"message": "Unsupported or invalid query filter clause specified for property 'businessPhones' of resource 'User'.",
"innerError": {
"date": "2021-07-30T08:07:24",
"request-id": "ac3923be-de11-448f-b2b5-245edc82d20e",
"client-request-id": "ac3923be-de11-448f-b2b5-245edc82d20e"
}
}
}
Any ideas on what I am missing?
You need to use advanced query capabilities, which means you need to add a $count=true query string parameter and a ConsistencyLevel=Eventual header to your request.
Can anybody tell me how to get a list of just files in a particular folder on OneDrive using Microsoft Graph API? I believe I found an approach I have to use but either I don't understand something or it is impossible. I can get a list of children items in a folder. I can use $filter=folder ne null to get just a list of folders but I don't understand how to get a list of files. If I negate the expression, make it $filter=folder eq null it gives me an error. I tried many other possible expressions like $filter=file ne null, $filter=size ne 0 even though it is not exactly a filter for files a files can be 0 size but anyway it gives an error as well.
Update:
Tested in a test tool. It gives
{
"error": {
"code": "invalidRequest",
"message": "Invalid request",
"innerError": {
"date": "2021-02-23T06:25:08",
"request-id": "4d1903d3-d989-4d90-8130-479ac1b24af2",
"client-request-id": "4d1903d3-d989-4d90-8130-479ac1b24af2"
}
}
for this query
https://graph.microsoft.com/v1.0/me/drive/root/children$filter=folder eq null
Here is the link to the tool
https://developer.microsoft.com/en-us/graph/graph-explorer
I would like to remove a license from a user using the microsoft graph API. I am currently using graph explorer to experiment with this.
I have not found much information here regarding microsoftgraph. I find the microsoft documentation and examples unclear on this point.
Here is the data I have to work with. graph explorer snip_one I have tried option A)
When I post to the assignLicense endpoint, I get this error message, and I find little information via google/SO about this. graph explorer snip_two Specifically, I find little about
"Cannot convert a primitive value to the expected type 'Edm.Guid'"
{
"error": {
"code": "Request_BadRequest",
"message": "Cannot convert a primitive value to the expected type 'Edm.Guid'. See the inner exception for more details.",
"innerError": {
"request-id": "7e63fcf2-8fce-4a5c-9f40-3348fba1fb13",
"date": "2019-12-05T01:37:14"
}
} }
OK, with more experimentation, the skuID was what was needed in the removedLicenses list
It's the GUID here: https://learn.microsoft.com/en-us/azure/active-directory/enterprise-users/licensing-service-plan-reference
Note there's a link to the latest version in CSV file format.
I'm trying to $expand on singleValueExtendedProperties for a delta query on my messages, but I'm getting an odd error.
Delta query
https://graph.microsoft.com/v1.0/me/mailFolders/Inbox/messages/delta?$expand=singleValueExtendedProperties($filter=id eq 'String 0x007D')
Response
{
"error": {
"code": "InternalServerError",
"message": "Value cannot be null.\r\nParameter name: type",
"innerError": {
"request-id": "d7cf6c83-a062-4051-85b4-30a5aadf2e65",
"date": "2017-10-06T10:05:10"
}
}
}
The documentation says this is supported. I've also verified (via the GraphAPI explorer) that:
the non-delta version of the query works with singleValueExtendedProperties
the delta version works without singleValueExtendedProperties
Is this a bug in the API or expected behavior? I know I can follow up with multiples GETs to pull the desired extended properties, but I'd rather avoid spawning several requests if I can get away with one.
There is limited support for the $filter query parameter on messages/delta. From the documentation:
The only supported $filter expresssions are $filter=receivedDateTime+ge+{value} or $filter=receivedDateTime+gt+{value}.
I would like to obtain the OneDrive content using Microsoft Graph filtered by date so that only files created between particular dates are obtained.
I have tried:
/v1.0/me/drive/items/{id}/children?filter=createdDateTime ge 2016-02-26T14:41:09Z
but get following response
"error": {
"code": "invalidRequest",
"message": "The request is malformed or incorrect.",
"innerError": {
"request-id": "c636022f-2fa9-4e41-b8fc-63be5fc5e681",
"date": "2017-04-07T10:05:46"
}
}
I have also tried:
/v1.0/me/drive/root/children?filter=name eq 'folderapr05'
and it works.
Does OneDrive support filter parameter for dates?
Filtering by dateTime isn't supported.
If you're attempting to do this for the purposes of syncing with OneDrive, you may want to take a look at delta. This method allows your app to track changes to a drive and its children over time.