Can't add description to OneDrive folders - microsoft-graph-api

I'm posting a create item http request the to the graph api ("\children") to create a folder under a groups files, but I'm getting the following error:
"code": "-1, Microsoft.SharePoint.Client.InvalidClientQueryException",
"message": "The property 'description' does not exist on type 'oneDrive.item'.
Make sure to only use property names that are defined by the type."
It does not allow description to be part of the the request body json, even though the documentation says it is a read-write property on the item type.
Please help anyone!?:) The description field could be really valuable to store additional info about a folder or file.

The description property isn't support for OneDrive for Business right now, which is why this call fails. If you create a folder without the description property the call should succeed. I've made updates to the documentation to remove the description property from the docs until it's supported for OneDrive for Business.

Related

Acumatica OpenAPI can not search stock item by barcode in cross references

I'm trying to use OpenAPI to fetch data from Acumatica.The filter is barcode in CROSS-REFERENCEEimage.
It's unable to fetch data(before change) because
"The parent value for a property access of a property 'AlternateID' is not a single value. Property access can only be applied to a single value."
I did some research and find a same question(OData $filter with items in a $expand).
I changed(after change) my request but still get
"exceptionMessage": "The method or operation is not implemented." error.
I really know nothing about OData and C#.I use JAVA/NODEJS to fetch data. Can someone give me any suggestion? Thanks a lot.
You can't do it this way.
Acumatica doesn't support filtration over the detail records.
Instead, you can create a new GI that will contain the information from the Inventory Item and corresponding Alternate IDs and request the records from that GI.

Graph API - Update SharePoint Library Fields after Drive Upload

I am uploading files via the Microsoft Graph Rest API for SharePoint Online. I am leveraging the Drive Upload API to push files into a document library but I am not seeing a easy method to set field values on a file after or during the upload. Reviewing the API documentation, it appears you can leverage the List API to update/set fields, but you have to first find the id of the list object (file) and then perform the patch to update the fields. I am curious if there is a method that uses the file Id or some other tag I get from the upload to easily set field values?
I am leveraging the following for uploads:
PUT /sites/{site-id}/drive/items/{parent-id}:/{filename}:/content
It appears I need to find the new file I uploaded by name, then patch the fields I want set:
GET https://graph.microsoft.com/v1.0/sites/{site-id}/lists/{list-id}/items
PATCH https://graph.microsoft.com/v1.0/sites/{site-id}/lists/{list-id}/items/{item-id}/fields
Post Answer Edit:
You can get the List ID value by going through the relationship of the drive object.
GET /sites/{site-id}/drive/items/{item-id}/ListItem
An item in a SharePoint document library is a linked item consisting of the DriveItem and the ListItem. Your PUT-Request returns the created DriveItem. Each DriveItem has a property called listItem, which contains the linked ListItem.
You can use the property id of the linked listItem to update the item directly without searching for the ListItem. First, upload the document and wait for the response:
var driveItem = PUT /sites/{site-id}/drive/items/{parent-id}:/{filename}:/content
Next, get the item id of the ListItem:
var listItemId = driveItem.ListItem.Id
Then, update the ListItem:
PATCH https://graph.microsoft.com/v1.0/sites/{site-id}/lists/{list-id}/items/{listItemId}/fields
So far, I have not come across an easier way to do this.

$expand=permissions failed with notSupported error

The documentation clearly states that this endpoint supports $expand to modify the search result:
users/{user-id}/drive/root/search(q='{search-text}')?$expand=permissions
But the request returns the following body in its response:
{
"error": {
"code": "notSupported",
"message": "The request is not supported by the system.",
"innerError": {
"request-id": "30fc9988-6f4f-46ba-a5b4-91b150c4a1a5",
"date": "2017-11-17T02:30:49"
}
}
}
This is also the case for other relationships. Though trying to expand createdByUser results in a BadRequest.
We want to do this request to avoid doing subsequent requests. Because at the moment we use a SharePoint ListItemUniqueId (due to backwards comparability) to find the corresponding DriveItem. Then we want to retrieve the permissions of this DriveItem. But right now we need to do two requests to achieve this.
We also can't use /users/{user-id}/drive/items because it does not support $filter.
Are we misunderstanding the docs or is this an issue on the Microsoft Graph side?
You cannot expand the permissions collection. From the documentation:
The permissions relationship of DriveItem cannot be expanded as part of a call to get DriveItem or a collection of DriveItems. You must access the permissions property directly.
The reason $expand=createdByUser returns a BadRequest is because it is already expanded by default.
Properties that are not supported are in $expand on the /search endpoint are:
children - Since /search returns files, this logically wouldn't make any sense here.
lastModifiedByUser - included by default
content - logically the content of each file wouldn't make sense to be included in a collection of DriveItems
Thumbnails can be expanded however ($expand=thumbnails).

Missing property in resourceVisualization in Trending endpoint

The documentation for resourceVisualization resource type (Trending endpoint) says that one of the properties that gets returned as part of the object is type.
However, when I use Graph Explorer to test the endpoint I don't see this property. Is it going to be added soon?
We have that identified and we are working on updating the API schema to have that property available by the end of next week.
Mario

What is the best way to handle https error codes in iOS?

My goal is to show a source of error to user. For now I'm using NSError localizedDescription string and check if network is reachable.
But sometimes 403, 500... codes appear. I should not display any technical code to user, all error codes must be translated in meaningful english. As I see it, one of the possible solutions is to manually check status code of most popular http errors and provide messages for them.
So my question is, what is the best approach to display http errors to user?
You can display localized description to user. Localized description's core goal is readability so you should use it!
Localized Description :
A string containing the localized description of the error. (read-only)
The object in the user info dictionary for the key NSLocalizedDescriptionKey. If the user info dictionary doesn’t contain a value for NSLocalizedDescriptionKey, a default string is constructed from the domain and code.
So, if there is no value for NSLocalizedDescriptionKey is found then it will return string from domain and code!
So, in this kind of case you can manage your own custom messages! You can set some common standard message also like - server is not responding or unable to complete request etc!!!

Resources